The Springboks restricted New Zealand's usual attacking fluency
South Africa: (13) 21
Tries: Habana, Wannenburg
Pens: Pretorius 3
New Zealand: (13) 20
Tries: Carter, Rokocoko
Cons: Carter 2
Pens: Carter 2
A late penalty from Andre Pretorius ended New Zealand's run of Test wins at 15 as South Africa salvaged some pride with a gutsy victory in Rustenburg.
Joe Rokocoko's converted try with 14 minutes left appeared to have given the All Blacks a Tri-Nations clean sweep.
But Pretorius stepped up to snatch victory after the sides went in level at 13-13 at half-time.
Bryan Habana scored in reply to Daniel Carter's try before Pedrie Wannenburg put the Boks 18-13 up after 55 minutes.
But after Rokocoko's try the visitors, already crowned champions for a second successive year, could not resist the hosts' frantic late efforts.
Victory would have put them within one win of the world record of 17 straight Test victories before their next appointment at Twickenham in November.
South Africa, desperate to restore pride after four consecutive defeats in the tournament, had the better of the frenetic early exchanges.
Andre Pretorius, on his return to the team, landed two penalties to one by Carter, before the All Blacks showed their attacking prowess as the first quarter drew to a close.
Rokocoko came off his right wing to create an overlap, Carter's pass sent Chris Jack through and when he was held up, Jerry Collins popped the ball up for Carter to dive over.
Carter scored the opening try
The fly-half converted for a 10-6 lead, only for the Springboks to hit back within a minute.
Number eight Rodney So'oialo's pass was intercepted by the jet-heeled Habana, who raced away for his 16th try in 22 Tests, Pretorius coverting.
New Zealand had a second try ruled out after 37 minutes for an obstruction by So'oialo, but Carter levelled it at 13-13 with a penalty with the last kick of the half.
Pretorius missed a drop-goal attempt on the resumption but the Springboks regained the lead with their best move of the match in the 55th minute.
Stealing possession from an All Blacks line-out, which again failed to function smoothly, they went through the phases, a thrust from Pierre Spies and quick hands from Pretorius allowing Wannenburg to plough over.
Pretorius was unable to convert, and New Zealand coach Graham Henry sent on five replacements in quick succession to try to restore order.
The changes yielded a swift reward when Rokocoko collected Mils Muliaina's clever grubber kick to touch down for his 32nd try in 36 Tests.
Despite South Africa's best efforts, the visitors looked to have held out until two minutes from time, when So'oialo was penalised for not rolling away at a ruck.
Pretorius kept his nerve to strike the kick sweetly between the posts, to the relief and delight of the Springbok nation.
South Africa: Jaque Fourie; Akona Ndungane, Wynand Olivier, Jean de Villiers, Bryan Habana; Andre Pretorius, Fourie du Preez; Os du Randt, John Smit (capt), BJ Botha, Johann Muller; Victor Matfield, Pedrie Wannenburg, Pierre Spies, AJ Venter.
Replacements: Chiliboy Ralepelle, Lawrence Sephaka, Albert van den Berg, Jacques Cronje, Ruan Pienaar, Butch James, Breyton Paulse.
New Zealand: Doug Howlett; Joe Rokocoko, Mils Muliaina, Aaron Mauger, Sitiveni Sivivatu; Dan Carter, Jimmy Cowan; Tony Woodcock, Andrew Hore, Carl Hayman, Chris Jack, Ali Williams, Jerry Collins, Richie McCaw, Rodney So'oialo.
Replacements: Anton Oliver, Neemia Tialata, Jason Eaton, Marty Holah, Byron Kelleher, Luke McAlister, Rico Gear.