In an incredible back-and-forth Test match, a mixture of stunning Springboks play and uncharacteristic errors from the hosts earned South Africa a first ever win at Westpac Stadium.
It took an almighty show of resolve from Rassie Eramus' side, which saw a 14-point second-half advantage chipped away with the situation not helped by a late yellow card for Willie le Roux.
But, despite a relentless spell of pressure, the All Blacks, who would have retained the title with a bonus-point victory, could not find the final score, with Beauden Barrett left to reflect on a rare off day in which he missed four conversions, including two relatively simple efforts that hit the post in the second half.
South Africa, for whom Aphiwe Dyantyi scored two of five tries, can now look back on a famous win — its first over the All Blacks since 2014 — that saw it rack up its highest points tally in New Zealand.
The hosts were typically fast out of the blocks and a superb sleight of hand from Beauden Barrett set brother Jordie over the line, before the excellent Ben Smith led another breakaway to play in namesake Aaron.
South Africa, which came into the match on the back consecutive defeats to Argentina and Australia, recovered from that early onslaught and Le Roux set up Dyantyi to break in from the left and touch down under the posts.
A poor quickly taken lineout from Jordie Barrett then popped up kindly for Le Roux to add an easy try, and Malcolm Marx crashed over after a big drive.
Rieko Ioane crossed for the All Blacks' third try after a 20-phase move, but a second missed conversion coupled with a Handre Pollard penalty had South Africa up by seven at the break.
Half-time replacement Cheslin Kolbe stretched the lead after a fine interception of Anton Lienert-Brown's pass and, although Ioane scrambled over in the left corner, Dyantyi crossed for his brace after neat work from Elton Jantjies and Warren Whiteley.
A huge rolling drive saw Codie Taylor reduce the gap, Beauden Barrett inexplicably missing the conversion, before Le Roux was sin-binned for cynical offside with fewer than 15 minutes to play.
An inevitable barrage came and Ardie Savea scored in similar fashion to Taylor, but Barrett once again failed with a simple-looking kick that rebounded off the post.
Still New Zealand came, and South Africa held up its opponent on the line before Damian McKenzie knocked on at the last to end a breathless encounter and bring tears of joy to some of the visiting contingent.