Cape Town: South Africa beat Sri Lanka by ten wickets to clinch the series 2-1 on the fourth day of the third and final Test at Newlands on Friday, despite a fighting century by Thilan Samaraweera. (Agencies)
Samaraweera's 115 not out and some bold hitting by the tailenders enabled Sri Lanka to avoid an innings defeat.
They were bowled out for 342, leaving South Africa needing only two runs to win the match and the series.
The first delivery of the final innings was a no-ball by Dhammika Prasad which Alviro Petersen pushed past the bowler for the winning run.
Jacques Kallis finished off the Sri Lanka innings to claim bowling figures of three for 35.
He also equalled two South African Test records by taking four catches in the innings and six in the match after making a career-best 224 in South Africa's first innings.
Samaraweera and vice-captain Angelo Mathews put on 142 for the fifth wicket and prevented South Africa from taking a wicket before lunch.
But the introduction of the second new ball, which was taken one over before lunch, brought a breakthrough when Vernon Philander trapped Mathews leg before wicket for 63 in the fourth over after the interval with a ball which kept low.
Philander followed up by having Dinesh Chandimal caught at second slip by Jacques Kallis.
Samaraweera went to his second century of the series after batting for 283 minutes, facing 201 balls and hitting 13 fours.
He reached his hundred during a seventh wicket stand of 56 with Thisara Perera which was marked by some big hitting by Perera before the left-hander was caught in the deep by Morne Morkel off leg-spinner Imran Tahir for 30.
Kallis caught and bowled Rangana Herath before the last two batsmen, Dhammika Prasad and Chanaka Welegedera, both hit out effectively enough for Sri Lanka to avoid an innings defeat.
Welegedera hit Kallis for four and six off successive balls to take Sri Lanka one run ahead before he was comprehensively bowled by Kallis attempting another big hit.
It was South Africa's first series win at home since they beat Bangladesh in 2008/09. Since they had lost and drawn series against Australia and shared series with England and India.
South Africa won the first Test at Centurion by an innings and 81 runs but Sri Lanka hit back by winning the second Test by 208 runs.
Cape Town: South Africa beat Sri Lanka by ten wickets to clinch the series 2-1 on the fourth day of the third and final Test at Newlands on Friday, despite a fighting century by Thilan Samaraweera.