South Africa overturned an 11-point deficit as they fought off a spirited Scotland in Nelspruit.
Matt Scott's try helped the tourists move 10-6 up at half-time and Alex Dunbar crossed early in the second half to extend the advantage.
A converted penalty try brought the Springboks back to within four points.
JJ Engelbrecht touched down while Scotland's Jim Hamilton was sin-binned and Jan Serfontein's late score took the hosts out of sight.
The Scots, who lost their tour-opener against Samoa, will complete their South African series against Italy next Saturday, with neither side having won so far in the quadrangular tournament.
Prop Euan Murray passed a late fitness test to start at tighthead for the tourists, who gave debuts to Peter Murchie, Tim Swinson and Tommy Seymour.
And the odds seemed stacked against Scotland, with South Africa fielding a strong line-up that included Willie Le Roux, Bryan Habana, Morne Steyn, Ruan Pienaar and Jannie du Plessis.
Indeed, Juandre Kruger almost made it over the Scottish try line after running on to Steyn's almighty kick-off, the lock forward running the ball into touch.
Scotland settled into the match and Greig Laidlaw kicked Scott Johnson's side into the lead.
Steyn replied with two penalties of his own before Seymour's invention led to the game's opening try.
The Glasgow Warriors wing made a break for the line after chipping over Pienaar and, though he was stopped short of the line, the ball was recycled well for Scott to cross and set up a simple Laidlaw conversion.
Johnson's criticism following the tour-opening 27-17 loss to Samoa appeared to be having an impact as Scotland met the physical challenge of their hosts.
However, the interim head coach had to contend with knocks to fly-half Ruaridh Jackson and openside flanker Ryan Wilson, who were duly replaced by Peter Horne and David Denton.
Scotland's opening to the second half was bitter-sweet with another try and yet another injury.
Tim Swinson's burst towards the posts unsettled South Africa and the ball was worked left for Scott to offload to Dunbar, who got the verdict after his touchdown in the corner was referred to the TMO.
However, substitute Horne appeared to twist his knee during the move and was stretchered from the field before Laidlaw converted.
Laidlaw was moved to fly-half with scrum-half Henry Pyrgos coming on for Horne as Scotland sought to preserve their 11-point lead.
Their cause was helped by Steyn kicking a penalty wide, but South Africa were then awarded a penalty try after Scotland collapsed a maul on the line and the fly-half atoned for his earlier miss with the conversion.
The TMO was called up again after Jim Hamilton clashed with Eben Etzebeth and the Scotland lock was sin-binned.
Looking to capitalise, the Springboks found some momentum and Engelbrecht ran in a straightforward try on the left, Steyn converting.
Substitute Patrick Lambie's penalty meant Scotland needed a converted try to win, but South Africa finished strongly and replacement centre Serfontein put the seal on their win, Lambie adding the conversion.
South Africa: Willie Le Roux; Bryan Habana, JJ Engelbrecht, Jean de Villiers (capt), Bjorn Basson; Morne Steyn, Ruan Pienaar; Tendai Mtawarira, Adriaan Strauss, Jannie du Plessis, Eben Etzebeth, Juandre Kruger, Marcell Coetzee, Arno Botha, Pierre Spies.
Replacements: Bismarck du Plessis, Trevor Nyakane, Coenie Oosthuizen, Flip van der Merwe, Siya Kolisi, Piet van Zyl, Pat Lambie, Jan Serfontein.
Scotland: Peter Murchie; Tommy Seymour, Alex Dunbar, Matt Scott, Sean Lamont; Ruaridh Jackson, Greig Laidlaw (capt); Alasdair Dickinson, Scott Lawson, Euan Murray, Tim Swinson, Jim Hamilton, Alasdair Strokosch, Ryan Wilson, Johnnie Beattie.
Replacements: Fraser Brown, Jon Welsh, Moray Low, Alastair Kellock, David Denton, Henry Pyrgos, Peter Horne, Duncan Taylor.