Doug Howlett broke South African hearts with a match-winning last-minute try for New Zealand in Christchurch.
New Zealand 23 (12)
Pens: Carter (5), Spencer
South Africa 21 (21)
Tries: De Villiers, Cronje, Du Preez
Con: Montgomery (3)
South Africa looked to be heading for a stunning Tri-Nations win when they led 21-18 with seconds remaining.
The Springboks had scored three first-half tries and restricted the All Blacks to six penalties with a brave defensive display.
But Kiwi pressure finally paid off when winger Howlett found space on the right for the winning score.
"This isn't a look of relief on my face, it's a look of pride," said All Blacks captain Tana Umaga.
"I'm really proud of the way my guys stepped up and came back under all that pressure.
"We were really flat to start with and we got a hard talking to at half-time, and it was great that we came out and came back."
The match began in storming fashion when Jean de Villiers silenced the home crowd with the opening try inside 30 seconds.
Daniel Carter hauled New Zealand in front with three penalties, but further tries from Jacques Cronje and Fourie du Preez saw the Springboks lead 21-12 at half-time.
Three Carter penalties were the only scores in 39 minutes after the break and Graham Henry was on the verge of his first loss as All Blacks coach.
But Howlett came to the rescue to secure New Zealand's place at the top of the Tri-Nations table following last week's win over Australia.
"I think the biggest disappointment for us is that we didn't lift ourselves in this game as much as we have in our other games this season," said Springbok captain John Smit.
"We've lifted ourselves to a new level in each game we've played so far, but this is the first game in which we haven't improved."
Henry admitted the result had been a close call but remained upbeat about the way his side is progressing.
"Everybody would agree that was a game we could well have lost, but I'm proud of the commitment to go right to the end," he said.
"Rome wasn't built in a day. We are trying to introduce new ideas and we haven't perfected them yet.
"I feel there are too many rugby teams who change for change's sake rather than perfect the areas they are working on.
"We are working on perfection."
New Zealand: Muliaina; Howlett, Umaga (capt), Carter, Rokocoko, Spencer, Marshall; Meeuws, Mealamu, Somerville, Jack, Maling, Collins, Holah, Rush.
Replacements: Hore, Woodcock, Williams, Newby, Kelleher, Evans, Tuitupou.
South Africa: Montgomery, Paulse, Joubert, Barry, De Villiers, Van der Westhuyzen, Du Preez; Du Randt, Smit (capt), Andrews, Botha, Van den Berg, Burger, Venter, Cronje.
Replacements: Russell, Du Toit, Conradie, Davids, Van Niekerk, Rautenbach, Coetzee.