New Zealand were facing defeat despite a century stand between Brendon McCullum and Ross Taylor on the third day of a four-day match against South Africa A at Sedgars Park on Saturday.
The Black Caps were 230 for six at the close of play after being set 358 to win in their final warm-up match before the first Test against South Africa starts in Johannesburg on Thursday.
The tourists crashed to 67 for five before Taylor (79 not out) and McCullum (77) put on 139 for the sixth wicket.
The stand was ended when McCullum missed a pull shot against fast bowler Friedel de Wet and was bowled by a ball which kept low. He made his runs off 101 balls with 13 fours.
Taylor, 23, who is set to make his Test debut in Johannesburg, batted through until the close with captain Daniel Vettori, who has top-scored twice in three innings.
But the New Zealanders go into the last day still 128 short of victory with only the tail to follow. Taylor faced 116 balls and hit 13 fours and a six.
Left-arm swing bowler Lonwabo Tsotsobe took three wickets in four overs as the New Zealanders lost five wickets between lunch and tea. He had figures of three for 40.