Suranga Lakmal took three key wickets in a tense encounter Wednesday cut short by rain to guide Sri Lanka to their first one-day win over South Africa in 12 matches.
Dasun Shanaka hit 65 while Thisara Perera and Kusal Perera each made 51 as Sri Lanka blasted 306-7 off 39 overs. Set a target of 191 from 21 overs because of the bad weather, South Africa ran out of inspiration and finished on 187-9.
Lakmal bowled South Africa's stand-in captain and opener Quinton de Kock, and then at the climax of the game claimed the tourists' final batting hopes Willem Mulder and David Miller.
Sri Lanka had lost 11 previous one day games against South Africa stretching back to their last win in 2014 at the same Pallekele ground.
South Africa already had the series sealed by winning the first three one-day games on this tour. But de Kock was still disappointed in his first match in place of captain Faf du Plessis who has been ruled out with a shoulder injury.
"They kept picking up wickets at the right time and bowled well," he said. "It always hurts more when you lose as captain."