The visitors turned in a muscular performance, particularly in the second half after the Scots had led 10-8 at the interval.
However, for all the disappointment there was pride for home skipper Stuart Hogg who equalled the Scotland international tries record with a superb brace.
Here’s how the captain, and his Scotland team-mates rated in the penultimate match of the series.
Player ratings scale - 10: One of the best performances you've seen. 9: Outstanding. 8: Very good. 7: Good. 6: Average. 5: Poor, 4: Very poor. 3: A terrible day at the office. 2: Abysmal. 1: One of the worst performances you've seen.

. EDINBURGH, SCOTLAND - NOVEMBER 13: South Africa adn Scotland Line up's during the Autumn Nations Series match between Scotland and South Africa at BT Murrayfield, on November 13, 2021, in Edinburgh, Scotland. (Photo by Paul Devlin / SNS Group)
South Africa and Scotland line up during the Autumn Nations Series match at BT Murrayfield. (Photo by Paul Devlin / SNS Group) Photo: Paul Devlin - SNS Group

. Pierre Schoeman - 6
Toughest test yet for the Edinburgh loosehead and he relished the battle but Scotland were distinctly second best in the scrum. 6/10 Photo: Steve Welsh

. Stuart McInally - 6
Scotland struggled in the set-piece and it was a difficult game for the hooker in what was his first start for Scotland in a year. 6 Photo: Steve Welsh

. Zander Fagerson - 6
Tough old shift for the prop as South Africa freshened up their front row on the stroke of half-time. Photo: Ross Parker - SNS Group / SRU

. Grant Gilchirst - 6
Carried well but lineout battle was tough for the Edinburgh man. His clean catch helped set up the move for Hogg’s second try. Photo: Craig Williamson - SNS Group / S

13. Stuart Hogg - 8
Two brilliant finishes saw him draw level with Ian Smith and Tony Stanger as Scotland’s all-time leading try-scorers. A captain’s innings from Hogg who also became the world’s most capped male full-back. Photo: ANDY BUCHANAN

14. Substitutes
Scotland tried to freshen things up by introducing Hamish Watson but the game ran away from them as the second half wore on. High penalty count ultimately proved decisive and there was little the replacement could do. Photo: Ross Parker - SNS Group / SRU