Suranga Lakmal held his nerve as he bowled Sri Lanka to a thrilling three-run win over South Africa in the rain affected fourth one-day international in Kandy.
Lakmal conceded just four runs from the game's final over as the hosts pulled off a face-saving victory despite already having conceded the five-match series to the Proteas.
Dasun Shanaka's 65 in 34 balls and Thisara Perera's 51 not out rescued Sri Lanka from 198 to six to post 306 for seven in their 50 overs.
Rain meant South Africa had an adjusted target of 191 from 21 overs, but they fell just short.
Lakmal took three for 46, as South Africa leaked wickets despite maintaining a solid scoring rate.
Hashim Amla top-scored on 40 for the tourists but they could not find the eight runs required off the final over as Sri Lanka ended the possibility of a series sweep.