Akila Dananjaya reminded the Proteas once again that they can’t play spin in the fifth and final ODI on Sunday.
Heading into the match in Colombo, South Africa had already won the series 3-1.
But after losing the last encounter, captain Quinton de Kock and his teammates wanted to finish on a high.
Sri Lanka won the coin flip, though, and decided to bat first.
Captain Angelo Matthews then steered his team to 299/8 with a knock of 97*.
South Africa had every chance to get the winning score of 300, but once their top order failed it was tickets.
Hashim Amla was first to go without troubling the scorers.
He was followed by Aiden Markram (20), Reeza Hendricks (0), Heinrich Klaasen (3) and JP Duminy (12) as Dananjaya ripped through the SA batsmen.
De Kock saw all of them, including Wiaan Mulder (2) lose their wickets, as the captain was fighting a lone battle at the other end.
But he too became a victim of the bowling of Dananjaya (6/29), clean bowled for 54 with a beautiful delivery.
SA ended on 121 all out.