Brendon McCullum and Dean Brownlie hit half-centuries as New Zealand fought back on the second day of the first Test against South Africa at Newlands on Thursday.
New Zealand were 169 for four in their second innings at the close, still 133 short of avoiding an innings defeat.
McCullum made 51 and Brownlie was undefeated on 69.
They were still likely to lose the match but it was a much better showing by the tourists after a calamitous first day during which they were bowled out for 45 and then leaked runs at almost four an over.
New Zealand's bowlers and fielders gave an improved performance, restricting South Africa to 97 runs and claiming five wickets in 31.2 overs before the home side declared at 347 for eight, a lead of 302.
"Compared to yesterday, it was immense," said Black Caps fast bowler Chris Martin.
"The way we turned up with the ball was much better. We were more consistent and we dried up the runs which brought the five wickets. That set the tone for the way our batters went out and put up a much sterner fight."
Martin said harsh words had not been necessary for the players after the first day debacle.
"They were quite reasoned, quite straightforward -- the best way to deal with it was shown by the way they applied themselves today."
AB de Villiers made 67 for South Africa before being dismissed shortly before the declaration while Trent Boult and Martin both took three wickets for New Zealand.
Visions of the first day collapse were revived when Martin Guptill was dismissed by Dale Steyn in the first over of the second innings.
But McCullum and Kane Williamson dug in to blunt South Africa's renowned pace attack, although they only added 29 before Williamson was caught at gully off Jacques Kallis.
The tempo changed after tea as McCullum and Brownlie counter-attacked, scoring 77 in the first 10 overs after the interval as both Vernon Philander and Steyn took some punishment.
Both batsmen benefitted from fielding lapses.
Brownlie was dropped at gully by Dean Elgar off Steyn when he had 23 and again one run later in the following over by Alviro Petersen, also at gully, off Philander.
Then McCullum, on 39, survived a sharp chance to Kallis at second slip off Steyn. The three dropped catches came in successive overs.
"We played terrible cricket," admitted Petersen, who added only three runs at the start of the day before being bowled by Boult for 106.
"The bowling wasn't up to scratch, the catching wasn't up to scratch. For that hour or so it was not the standard we set ourselves."
McCullum made 51 before he played around his pads and was leg before wicket to left-arm spinner Robin Peterson, bowling for the first time in the match.
Brownlie took advantage of South Africa's attacking fields as he hurried to a half-century off just 44 balls, with eight fours but his scoring rate slowed down as he saw out the day.
He had faced 89 balls, batting for almost three hours, by the close.
Brownlie was given out, caught down the legside by wicketkeeper AB de Villiers off Steyn when he had 68. He sought a review of umpire Rod Tucker's decision which proved the ball had not touched his bat.
Petersen said the pitch was difficult to bat on.
"I said after the first day it was like a day three or day four wicket. I don't know if it was over-prepared. From a batting point of view you had to be disciplined."