New Zealand captured the key South African wicket of Dean Elgar late on day four to keep the faint prospect of a result alive in the first Test in Dunedin on Saturday.
At stumps, New Zealand had South Africa at 224 for six, a lead of 191 but with the prospect of a result threatened by forecast rain on the final day.
Elgar had been a shining light in the gloom of Dunedin, batting comfortably to keep New Zealand at bay as he backed up from a first innings 140.
But on 89 when he tried to lift the pace in the final session, Elgar skied a Jeetan Patel delivery which was taken by Kane Williamson running to his right from mid off.
On a chilly day in which play was disrupted twice by rain and gloom, Faf du Plessis on 56 and Vernon Philander on one when bad light ended play 20 minutes early on a tough day which produced only 186 runs and five wickets -- three in the final session -- at University Oval.
While Elgar slowly moved South Africa ahead on the board, New Zealand did not help their cause by committing a series of blunders, with their problems compounded by the light and an injury to Trent Boult.
When the new ball was taken in the final session, the umpires initially considered it too dark for the quick bowlers and New Zealand were reduced to spinners Patel and Mitchell Santner.
When it brightened again, Neil Wagner was the only fast bowler available with Trent Boult receiving treatment for an upper left leg strain.
Boult, who took the wicket of Stephen Cook in the first over of the South African second innings, delivered 11 overs without success on Saturday before leaving the field to join batsman Ross Taylor on the injured list.
Wagner had success with the wickets of Hashim Amla, caught at midwicket for 24, and JP Duminy who went lbw for 39.
Duminy had a charmed stay. He was dropped by Tom Latham on six, and on 20 he was given not out to a Patel appeal for lbw.
New Zealand did not review the umpire's decision, although the ball-tracker technology showed it was heading straight at leg stump.
Elgar also had a life when he brought up his half century with a cracking drive that went through the hands of substitute fielder Colin de Grandhomme at short cover.
Temba Bavuma was bowled by Mitchell Santner for six when he blocked the left-armer only for the ball to hit the pitch and spin back on to the stumps.
Patel then bowled Quinton de Kock (four), claiming the South African keeper for the fourth consecutive innings on this tour.
Patel had figures of two for 72 and Wagner two for 57.