Title winners New Zealand edged the Springboks 25-24 on Saturday in a thrilling 2017 Rugby Championship final-round match at Newlands stadium in Cape Town.
The lead changed hands several times before a brilliant Damian McKenzie try on 69 minutes helped the All Blacks build an eight-point advantage.
Down to 14 men after Damian de Allende was red-carded, South Africa fought back with a Malcolm Marx try converted by Elton Jantjies narrowing the gap to one point.
It was a stirring show from the Springboks after a humiliating 57-0 defeat in New Zealand last month — the heaviest in their 126-year history.
New Zealand completed the season with 28 points from six victories having won the title before even playing their penultimate match last week in Argentina.
South Africa have 14 points, Australia 10 and Argentina none. The Pumas host the Wallabies later on Saturday in Mendoza.
“What a game, what a crowd,” said All Blacks skipper Kieran Read. “It was an awesome game and credit to the Springboks.
“They certainly came out a totally different beast (from Auckland), they pushed us all the way.
“We knew it would be tough and it took over 80 minutes for us to get over the line, we just had to hang in there.
“The Springboks were getting over the gain-line with their big boys carrying down the middle, so we will need to look at our defence.”
Springboks skipper Eben Etzebeth said: “It was an unbelievable performance and I’m so proud of the boys.
“We did not get the result we wanted, but the performance was much better.
“We just have to stick together and keep working hard and then,hopefully, the results will come.
“The fightback showed that we were all warriors out there. We really appreciated the crowd support.”
A sell-out 50,000 crowd at Newlands stadium saw 10 pulsating minutes before Jantjies and All Black Beauden Barrett kicked penalties in quick succession.
New Zealand winger Rieko Ioane crossed the whitewash on 16 minutes, but big-screen replays showed that he lost the ball forward and the try was ruled out.
Jantjies had a chance to put South Africa ahead a second time after 25 minutes, but he pulled his penalty attempt just left.
A highly-charged battle for forward supremacy threatened to get out of hand at times and several players received warnings from French referee Jerome Garces.
With 32 minutes gone, New Zealand moved ahead with a try from Ryan Crotty that took the referee and television match official (TMO) a long time to confirm.
A Jantjies kick-ahead was charged down and a five-player chase for the ball ended with Crotty claiming he scored amid uncertainty as to whether he touched down.
It was a tight call and Garces and TMO Rowan Kitt from England reviewed the incident many times before awarding the try.
With Barrett off the field due to concussion, McKenzie took the conversion and missed.
The first half stretched to 50 minutes as both sides kept the ball in play and came close to scoring.
Ross Cronje was the central figure as South Africa took and lost the lead during the third quarter.
He scored on 44 minutes after Steven Kitshoff was held up just short of the line and Jantjies converted for a 10-8 lead.
But when the scrum-half threw a wild pass just before the hour, Ioane intercepted and raced 80 metres for a try Sopoaga converted.
The lead changed again when the outstanding Marx broke clear and sent Jean-Luc du Preez over for a try substitute Handre Pollard converted.
McKenzie then struck, taking a pass from David Havili and cutting through the defence to score with Sopoaga converting.
Sopoaga stretched the lead to eight points from a penalty awarded for a late, high tackle on him by De Allende, who was red-carded.
But a Springboks side unrecognisable from that crushed in Auckland last month hit back as Marx barged over after a line-out and Jantjies converted.
Springboks – Tries: Ross Cronje, Jean-Luc du Preez, Malcolm Marx. Conversions: Elton Jantjies (2), Handre Pollard. Penalty: Jantjies.
All Blacks – Tries: Ryan Crotty, Rieko Ioane, Wyatt Crockett. Conversions: Lima Sopoaga (2). Penalty: Beauden Barrett, Sopoaga.