In a thrilling match filled with plenty of drama, the Boks were deserved winners as they held the lead for most of the match.
The All Blacks outscored their visitors by six tries to five although poor goalkicking from Beauden Barrett cost the world champions in the end as he missed four shots at goal.
The win is a momentous result for the Springboks as it is their first triumph on New Zealand soil since 2009 and this is the All Blacks’ first defeat in the Rugby Championship since 2015.
South Africa were under the cosh early on when Handré Pollard’s kick to get the game underway went over the deadball line and, after an extended period camped inside the Boks’ half, the All Blacks opened the scoring. Jordie Barrett gathered a pass from his brother Beauden and glided through a gaping hole in the visitors’ defence before crossing for the opening try.
The older Barrett failed with the conversion attempt but the All Blacks continued to dominate and spent long periods inside South Africa’s half during the next 10 minutes.
And in the 16th minute, Ben Smith made a superb line break down the right-hand wing before throwing an inside pass to Aaron Smith, who cantered in for an easy five-pointer.
Barrett made up for his earlier miss and added the extras which gave the world champions a deserved 12-0 lead.
The visitors did not panic, however, and struck back midway through the half with a well-taken try from Aphiwe Dyantyi after good work from Malcolm Marx and Willie le Roux in the build-up.
That try was converted by Pollard and, although the Boks were trailing by five points, they were the dominant side for the next 15 minutes and were rewarded with two further tries during that period.
First, Jordie Barrett took a quick lineout just outside his 22 but the throw was an inaccurate one and Le Roux gathered the bouncing ball from under the nose of Rieko Ioane before crossing for the visitors’ second try.
And in the 32nd minute, the Boks went further ahead when Marx crossed the whitewash off the back of a lineout drive deep inside the All Blacks’ 22. Pollard converted both those tries which meant South Africa had their tails up with the score 21-12 in their favour.
The All Blacks needed a response and that came in the 38th minute when the ball was shifted to Ioane, who found himself in space out wide and he had an easy run-in for his side’s third try.
The Boks would have the final say of the half, however, when just before half-time Pollard added a penalty which gave his side a 24-17 lead at the interval.
The visitors made a dream start to the second half when two minutes after the restart Cheslin Kolbe intercepted a pass from Anton Lienert-Brown before racing away to score his side’s fourth try.
Pollard’s conversion was successful which meant the Springboks were leading 31-17 but the All Blacks struck back 10 minutes later when Ioane gathered a pass from Beauden Barrett before stepping past Kolbe on his way over the tryline.
But despite that score, the Springboks continued to attack and in the 57th minute Dyantyi rounded off a flowing move – in which RG Snyman, Steven Kitshoff, Elton Jantjies and Warren Whiteley all handled the ball superbly – which gave his side a 36-24 lead.
That boosted the Boks’ confidence but it did not deter the All Blacks who came roaring back in the 61st minute when Codie Taylor crossed the whitewash after a lineout drive close to the visitors’ tryline.
The final quarter saw the All Blacks launching several attacks deep inside the Springboks’ half as they looked to retain their unbeaten record in the competition. In the 67th minute, South Africa were reduced to 14 men when Willie le Roux was yellow carded for taking Ioane out from an offside position close to the Boks’ tryline.
With a numerical advantage, the All Blacks upped the ante on attack and were rewarded when Ardie Savea crossed the whitewash in the 74th minute after another lineout drive deep inside Bok territory.
The closing stages were a tense affair with the world champions continuing to attack close to the Boks’ tryline but the visitors kept them at bay with a heroic defensive effort and held on for a memorable win.