Aiden Markram's calm innings helped South Africa avoid suffering a series clean sweep by Afghanistan with a seven-wicket victory in the third one-day international in Sharjah on Sunday.
The Proteas cruised to their target of 170 thanks to an unbeaten 69 from Markram, having briefly wobbled at 80-3.
Afghanistan had already wrapped up a historic series triumph after winning the first two matches but struggled with the bat after winning the toss.
Only the in-form Rahmanullah Gurbaz put up any real fight with an excellent, 94-ball 89, but when he fell Afghanistan were 132-7.
Key batters Rahmat Shah, Hashmatullah Shahidi and Ikram Alikhil were all run out in a haphazard display.
Tail-ender AM Ghazanfar smashed 31 not out off 15 deliveries to at least give Afghanistan hope.
South Africa had been bowled out for 106 and 134 in the opening two games but found life easier against an Afghan attack missing the rested Rashid Khan and Fazalhaq Farooqi.
Afghanistan were still in the contest when Reeza Hendricks was dismissed by Fareed Ahmad, but Markram and Tristan Stubbs, who ended 26 not out, saw South Africa home with an unbroken stand of 90.