New Zealand 177 for 3 (Williamson 78*, Raval 52, Maharaj 2-57) trail South Africa 308 (Elgar 140, Bavuma 64, Boult 4-64, Wagner 3-88) by 131 runs
Scorecard and ball-by-ball details
Kane Williamson led a strong New Zealand first innings on the second day in Dunedin, but they had a significant injury cloud over Ross Taylor who was forced to retire hurt in the final session. Until that point things could barely have gone better for New Zealand after they removed the last six South Africa wickets for 56 before a stand of 102 between Williamson and Jeet Raval set up the reply.
New Zealand were still handily placed at the close on 177 for 3, with Williamson unbeaten on 78 alongside nightwatchman Jeetan Patel. However, they also lost Henry Nicholls, brilliantly caught at slip by Hashim Amla, to give left-arm spinner Keshav Maharaj his second wicket so South Africa will be aware they can target the middle order on the third morning with Taylor's future participation in the match uncertain.
Williamson batted outstandingly. He has the highest Test average by a New Zealand captain but, if the record is viewed highly critically, has yet to play a defining innings as leader: his average is boosted by early runs against Zimbabwe and his unbeaten century against Bangladesh in Wellington rubber-stamped a comeback victory rather than set it up. He has the chance now to shape a Test match against a side New Zealand have only beaten once at home - in Auckland in 2004.
South Africa had resumed on 229 for 4, but once Dean Elgar fell for 140 the lower order was whittled away. There was an opening session of sustained accuracy by New Zealand which continued their efforts from the first day when even though wickets dried up the scoring did not run away. The value of keeping South Africa's rate under control came to the fore when Quinton de Kock and Temba Bavuma, the last recognised batsmen, departed in quick succession.
It did not take long for South Africa to respond. Tom Latham was dropped during the one-day series and there was no immediate upturn in fortunes against the red ball when Vernon Philander switched to round the wicket, drawing him into pushing away from his body. In contrast, Raval left the ball well, forcing the bowlers to go straighter and then took them off through the leg side.
It was an excellent innings from Raval, who is in his fifth Test, after facing Pakistan and Bangladesh earlier in the season, and he was able to pick off Maharaj as he moved to a third Test fifty from 95 balls. But, as against Pakistan were he twice made 55, he could not go further when he clipped Maharaj to short midwicket.
The early contest between Williamson and Philander was absorbing; a classy new-ball bowler making it nibble against one of the game's leading batsmen. The value of Williamson's early caution was evident after tea when he started to milk Maharaj then took three boundaries in a row off Kagiso Rabada, including a brace of textbook on-drives, to move him past 50 off 87 balls.
In the period around when Taylor was forced to retire hurt with the score on 148 for 2, Morne Morkel, playing his first Test since January 2016, had returned for a second spell and opted for a burst of short deliveries. He struck Taylor on the helmet two balls before a leg injury ended the batsman's day and also had Williamson ducking, but finished his first foray back into the longer format wicketless form 10 overs.
Before play, Elgar had spoken about South Africa aiming to bat until tea and make around 380. They fell considerably short on both accounts. Neil Wagner bowled an 11-over spell in which he only faded towards the end; Patel kept his hold over de Kock and Trent Boult followed up Wagner's unyielding stint. Between them, New Zealand's two frontline quicks bowled more than 63 overs for seven wickets.
The first hour was nip-and-tuck - five runs coming off the first six overs of the day - and Elgar needed some fortune to reach a new career-high when he top-edged a short ball from Wagner over the slips. Wagner's finally extracted Elgar with another well-directed short ball which the left-handed batsman didn't know whether to play or leave, glancing a top-edge to BJ Watling - who caught him 104 runs after his leg-side miss the previous day.
Bavuma went to a 143-ball half-century, his first in eight innings since Hobart against Australia, and the reward for his watchfulness started to come when he took three boundaries off the last over of Wagner's spell: a clip, a pull through midwicket and a flat-batted swat straight past mid-on. But he couldn't fully cash in, feathering Boult down the leg side when he shuffled well across his crease.
By then, de Kock, someone who could have lifted the scoring rate, had also departed to the man who has troubled him most on this tour. Patel claimed him in each of the final two ODIs and added his name again here, luring de Kock into reaching for a drive and spooning a catch to backward point where Wagner still had the energy to dive forward.
Boult returned to prevent any significant tail-end contributions, ending the innings shortly after lunch when he speared one through Philander to finish with 4 for 64. He and Wagner will have hoped for a long time with their feet up. Their captain could hold the key to that.