Wales made history by beating the Springboks in South Africa for the first time with a dramatic win in Bloemfontein.
Replacement fly-half Gareth Anscombe kicked a brilliant 79th-minute touchline conversion after Josh Adams scored the game’s only try.
South Africa, with 14 changes, had appeared to be coasting to victory with four Handre Pollard penalties.
But there will now be a series decider in Cape Town next Saturday.
South Africa had promised to bury Wales in the series in Bloemfontein, a ground that has been described as a graveyard for opposition sides.
And Wales certainly appeared to be dead and buried as they trailed 12-3, but they battled back heroically and crossed with their only real try-scoring opportunity.
Anscombe, on for the injured Wales captain Dan Biggar, kicked the conversion to complete the turnaround.
It was a disjointed attacking performance from Wayne Pivac’s side, but they will not care.
The defensive efforts of Dan Lydiate and, most notably, man-of-the-match Tommy Reffell had allowed the tourists to stay in touch with the Springboks before the late drama carried them to Test victory in South Africa at the 12th attempt.
South Africa head coach Jacques Nienaber had sparked controversy when he announced his team, with 19 alterations in the match-day 23 from the team that triumphed by three points in the first Test.
Wales great Sir Gareth Edwards has been among the critics of South Africa’s selection approach, believing it disrespected the tourists.
The Springboks vehemently denied this and insisted this was not a B team, a phrase that had not been used by anybody in the Wales camp.
But only lock Eben Etzebeth remained from the first-Test starting side as he earned his 99th cap.
Two uncapped players, Bulls wing Kurt-Lee Arendse and Stormers number eight Evan Roos, started, while four others came off the replacements bench.
In contrast, Wales made one starting change with wing Alex Cuthbert replacing Adams, who dropped to the replacements’ bench.
It was the first international in four years at Bloemfontein since England visited and played in front of a capacity crowd.
Prop Trevor Nyakane promised South Africa would be silent bullies and inflict pain on their opponents, but Wales made the ideal start.
South Africa were penalised from the kick-off and Biggar slotted the three points.
The Springboks responded with a flowing move from Warrick Gelant, almost releasing Arendse to score.
Desperate Welsh defence stopped the try, but illegally, and Pollard levelled the scores.
South Africa hooker Joseph Dewba was penalised for a tackle off the ball only for Biggar to put his long-range effort wide, before Pollard missed a similar effort.
Cuthbert’s afternoon was over early as he cut a frustrated figure leaving the field to be replaced by Adams.
Basic errors crept into the Wales game, but their resistance was again evident with Elias and Reffell gaining crucial defensive turnovers as half-time arrived with the scores level 3-3.
Wales changed their scrum-half at the interval with Tomos Williams replacing Hardy, while South Africa introduced front-row duo Malcolm Marx and Vincent Koch.
Pollard slotted over his second penalty to give the hosts the lead and back row Deon Fourie, 35, became the oldest South Africa player to make his debut before Pollard slotted over his third penalty.
Wales captain Biggar was finally forced off with a shoulder injury after having a couple of bouts of treatment, with Anscombe coming on.
The Springboks were overwhelming Wales, who again were punished for indiscipline, but Pollard this time hooked his kick wide.