Richie McCaw's try sparked the All Blacks' fightback
South Africa (11) 21
Tries: Burger, James
Pens: Montgomery (2), Pienaar
New Zealand (6) 26
New Zealand justified their position as the world's best team by coming from behind in Durban to edge closest rivals South Africa in the Tri-Nations.
Tries: McCaw, Rokocoko
Pens: Carter (3)
Cons: Carter 2
Dan Carter cancelled out two early Springboks penalties before the hosts took the initiative with a Schalk Burger try just before the interval.
Aaron Mauger landed a drop-goal on the resumption but his risky pass allowed Butch James to streak away for a try.
But late scores from Richie McCaw and Joe Rokocoko saw the All Blacks home.
They trailed 21-12 with 14 minutes left but a stunning break from number eight Rodney So'oialo launched a superb counter which culminated with McCaw picking up and diving over.
Dan Carter, who had endured a mixed day with the boot, converted to make it 21-19 and the visitors struck again two minutes later.
Full-back Leon MacDonald picked up a loose ball and timed his pass perfectly to Rokocoko, who roared away for a classic sucker punch, Carter adding the extras.
It's a tough place to come to get a win, and it's a very important one for us
All Blacks captain Richie McCaw
The Springboks, visibly deflated in front of a capacity 50,000 King's Park crowd, tried to turn the tide but New Zealand kept their line intact for a psychologically important victory.
Many pundits believe the two sides will face each other in the World Cup final come October.
And South Africa, buoyed by the their late victory over Australia a week ago, tore into the All Blacks in the opening exchanges.
An early penalty from Percy Montgomery was improved by a 53m effort from scrum-half Ruan Pienaar as the hosts led 6-0 at the end of the first quarter.
Burger's try had put the Boks in command at half-time
New Zealand gradually picked up the pace though and two Carter penalties - either side of another missed attempt - made it 6-6 two minutes before half-time.
But South Africa regained the advantage at the interval when Burger emerged with the ball after a superb driving maul split the All Blacks defence.
Despite Mauger's drop-goal on the resumption, the initiative remained with the hosts when James plundered a try after 46 minutes, Montgomery converting for an 18-9 lead.
They lost Pedro Wannenburg to the sin-bin barely a minute after he had replaced the returning Bob Skinstad in the back row.
But despite Carter landing a penalty to bring the All Blacks to within six points, Montgomery restored the nine-point cushion after 66 minutes.
We didn't convert our chances and simply let it slip at the end
Boks captain Victor Matfield
It proved insufficient, however, as New Zealand's clinical finishing turned the match around in the space of two minutes.
They will return home to prepare to face Australia in Melbourne next Saturday as favourites to claim a third successive Tri-Nations title.
South Africa: Montgomery; Willemse, Fourie, De Villiers, JP Pietersen; Butch James, Ruan Pienaar; Du Randt, Gary Botha, BJ Botha, Bakkies Botha, Matfield (capt), Burger, Rossouw, Skinstad.
Replacements: Du Plessis, CJ van der Linde, Muller, Wannenburg, Claassens, Olivier, Steyn.
New Zealand: Muilaina; Rokocoko, Toeava, Mauger, Sivivatu; Carter, Kelleher; Woodcock, Oliver, Hayman; Flavell, Rawlinson; Collins, McCaw, So'oialo.
Replacements: Mealamu, Tialata, Filipo, Masoe, Weepu, McAlister, MacDonald.
Referee: Alain Rolland (Ireland)