Fullback Damian Willemse has kicked a pressure penalty after the hooter to secure South Africa a 32-29 victory over ill-disciplined Wales in a see-saw test at a raucous Loftus Versfeld.
Wing Louis Reece-Zammit crossed for two tries and Dewi Lakea got a third for the tourists, who took the world champions close, but paid the price for their cynical play in their own 22, as they lost four players to yellow cards and conceded a penalty try.
The Springboks might have won by a greater margin, but for their own lacklustre play, as their tactical kicking was abysmal and decision-making in key phases of play unusually poor.
Hookers Bongi Mbonambi and Malcolm Marx, and wing Cheslin Kolbe crossed for tries for the home side, who were playing their first test in eight months.
The second of three tests in the series will be played at Bloemfontein next Saturday, with Wales still in search of a first win in South Africa, after 11 attempts.
"I'm gutted," Wales flank Dan Lydiate told Sky Sports. "There was a lot of momentum shifts in that game and we thought we nicked it, but it wasn't to be.
"We were disappointed after the Six Nations and we wanted to put in a good performance today to restore pride in the jersey, but we came here to win and we're gutted with the result.
"Discipline, we talked about it going into the camp, and we have to look at ourselves and rectify it for next week."
Wales threatened to spoil the party as a sellout crowd of 51,762 roared on the Springboks, the first time in 1051 days the home side had played in front of their own fans.
They will have felt let down with the opening 60 minutes of the game, as Wales led 18-3 at halftime and were good value for that advantage against a sloppy home side.
But once the altitude began to play its part, South Africa forced the visitors into cynical penalties in their own 22, through sheer pressure and power on the ball.
The game swung in their favour, as Wales at one stage had only 12 players on the pitch, after yellow cards for skipper Dan Biggar, Alun Wyn Jones, Reece-Zammit and Rhys Carre.
Biggar had the chance to put Wales in front with two minutes on the clock, but missed the conversion of Lake's try, which allowed the Boks to go up the other end of the pitch and steal the victory.
"They stopped our mauls and we couldn't get going, but the way we came back, that's what we take pride in," Bok captain Siya Kolisi said.
"Wales knew what we wanted to do and they stopped that to start - we weren't kicking on our terms, so we had to find energy. The guys off the bench did that.
"We have so much respect for them and it is always difficult to play them."
Reuters