Colin de Grandhomme's quickfire half-century and a slew of poor strokes from the South African top order has handed the advantage to the hosts on an enthralling day of cricket at Seddon Park.
Resuming on their overnight lead of 7, Williamson and Santner were bogged down by some tight bowling by Rabada and Morkel. Morkel eventually had Williamson for 176 and Santner soon followed to leave New Zealand's lower order to build a good lead.
Extra Cover: New Zealand closing in on victory against Proteas
de Grandhomme did just that with some lusty blows and then returned to dismiss Dean Elgar quickly. Horrible running between the wickets saw the back of debutant de Bruyn and Amla, and Duminy threw away their wickets to Patel. de Kock and du Plessis carried the team to stumps but it is safe to say that New Zealand hold all aces going into day 5.
Brief Scores: South Africa 314/10; New Zealand 489/10 (Williamson 176, Raval 88, Morkel 4/100); South Africa 80/5 (Amla 19, Patel 2/22)
Have a glance at the major talking points of the 4th day of the final Test from Hamilton.
#5 Santner's struggling knock
New Zealand had opted to bring in Mitchell Santner for James Neesham given that the pitch was on the slower side. But unlike Neesham, Santner is yet to prove his credentials with the bat in Tests and asking him to bat at No. 6 seemed like a gamble.
The left-hander played out some tired bowling with solid defensive strokes at the fag end of Day 3. Even a fresh South African attack on Day 4 could not break through Santner but he was patchy against short balls that it was only a matter of time before something gave way.
That did not happen for 151 balls, however. He hung around long enough to watch Kane Williamson top edge Morkel. Santner had looked uncomfortable against Rabada and Morkel and eventually edged nicked the former to gully to depart for 41.
#4 Kane Williamson masters South Africa but falls short of double hundred
The New Zealand skipper played one of the best innings seen in the country in a long time to take New Zealand past South Africa's score. By the end of Day 3, he was unbeaten on 148 and looked set for a deserved double hundred.
The middle-order batsman started the day with some punchy defensive strokes and left balls outside his off-stump. His concentration was on staying out there past the gloomy conditions to latch onto the Proteas bowlers. His first boundary of the day, an edge off Philander to the third man fence, did not come until he had faced 45 balls.
He only hit one more boundary, a sweetly-timed straight drive off Morne Morkel. But two balls later, he top edged the same bowler when trying to hook him, only to be caught by Philander running in from the deep square leg boundary. Williamson had missed out on a deserved double ton by 24 runs but he had given the Kiwis a distinct advantage.
#3 de Grandhomme rocks South Africa
New Zealand had lost their set batsmen by tea and needed de Grandhomme and Watling to score some quick runs and set up a declaration. The burly all-rounder went about his business in style playing some attractive strokes to race to a maiden half-century.
While Watling was patient and focussed on staying in the middle, de Grandhomme went in search of some quick runs and found them. When Duminy came into the attack, the all-rounder was quick to deposit him twice over the fence.
After taking New Zealand to sizeable lead, he returned with the new ball to grab the big wicket of Dean Elgar, who nicked a good length delivery to the keeper.
#2 Jeetan Patel has South Africa in a mess
South Africa were trailing by 175 runs when they came out to bat a second time. A tricky period in the final session was left to be conquered but New Zealand made it tough for their batsmen by nipping out Elgar and Theunis de Bruyn early.
Patel then entered the attack and had Amla caught at slip courtesy some extra bounce. The offie then removed JP Duminy, who shouldered arms to a delivery that drifted in and went with the angle.
Suddenly South Africa were 50/4 and Patel had put the Kiwis in the driving seat. The off-spinner had been rather subdued apart from his spells against de Kock, but the twin wickets today has given him a new lease of life in the Test side.
#1 South Africa's middle order woes
South Africa are having a tough time managing their middle order batsmen in the absence of AB de Villiers. While just a few months ago his absence did not seem to affect the team much, Duminy's poor returns combined with Amla loss of form has affected the team.
Today, they were held back by some really poor shots from their middle order batsmen. None of them displayed the composure and doggedness expected in such situations apart from the skipper.
Bavuma seemed in a hurry, Amla wafted at a short and wide delivery and Duminy was glad to leave a ball that came straight at the stumps. If Faf du Plessis and de Kock can't put up a real fight tomorrow, South Africa would have spoiled an easy chance to win the series.