Pallekele: David Miller (85* and Lonwabo Tsotsobe (4-22) and Farhan Behardien (3-19) did well with the ball to help South Africa defeat Sri Lanka by 56 runs in the 3rd ODI in Pallekele.
South Africa stay alive in this series and the scoreline is now 2-1.
This is only the second time South Africa have beaten Sri Lanka in Sri Lanka, after their maiden victory in 1993.
South Africa's top and middle order struggled for direction and it needed an explosive finish from David Miller to give them a defendable total. Then Morne Morkel and Tsotsobe cut open the Sri Lankan innings with the new ball.
South African spinner Robin Peterson bowled the second most expensive over in one-day cricket when he conceded 35 runs against Sri Lanka on Friday.
Left-hander Thisara Perera hit five sixes and a boundary in the 33rd over sent down by Peterson in the third one-day international in Pallekele.
With the second ball declared a wide, the 35 runs taken in the over fell just one run short of the world record of six sixes hit by South African batsman Herschelle Gibbs off Dutch bowler D. van Bunge during the 2007 World Cup.
Perera's run sequence in the over was six, a wide, six, six, six, four and a six.
Earlier, David Miller smashed a robust 85 not out off 72 balls to steer South Africa to 223 for 7.
The left-hander smashed five sixes and four boundaries after a three-wicket haul from unorthodox spinner Ajantha Mendis had reduced the tourists to 154-7 in the 42nd over.
The Proteas, missing star batsman Hashim Amla due to a knee injury suffered in the previous match, had slipped to 100-5 after winning the toss in the day-night match.
Skipper AB de Villiers led the recovery with 47, before Miller pushed the scoring with his fifth one-day half-century, the first by a South African in the series.
Miller put on 69 for the eighth wicket with Ryan McLaren, who remained unbeaten on 14.
Angelo Mathews was back to lead Sri Lanka after serving a two-match suspension for his team's slow over-rates during the recent tri-series in the West Indies.
Sling-arm fast bowler Lasith Malinga provided an early break for the third time in the series when he had Alviro Petersen gloving a catch to the wicket-keeper in the fifth over.
South Africa carried the score to 50-1 in the 14th over when seamer Thisara Perera removed Quinton de Kock and JP Duminy in successive overs to make it 53-3.
Faf du Plessis helped de Villiers put on 42 for the fourth wicket before being run out for 16 after his partner called for a risky single.
Mendis bowled both Farhaan Behardien and Robin Peterson, and had danger man de Villiers caught behind to finish with three for 35 from his 10 overs.
Earlier, South African skipper AB de Villiers won the toss and decided to bat.
Hashim Amla isn't fit, and replaced by Quinton de Kock. South Africa have also brought in Farhaan Behardien for Aaron Phangiso and Lonwabo Tsotsobe for Chris Morris.
Sri Lanka have also made three changes. Out go Shaminda Eranga, Lahiru Thirimanne (injured) and Jehan Mubarak. They have been replaced by the returning regular captain Angelo Mathews, Ajantha Mendis and the debutant Angelo Perera, a middle order batsman who bowls a little offspin.
Teams:
Sri Lanka: Upul Tharanga, Tillakaratne Dilshan, Mahela Jayawardene, Kumar Sangakkara (wk), Angelo Perera, Thisara Perera, Dinesh Chandimal, Angelo Mathews (captain), Rangana Herath, Ajantha Mendis, Lasith Malinga
South Africa: Quinton de Kock (wk), Alviro Petersen, Jean-Paul Duminy, AB de Villiers (Captain), Faf du Plessis, David Miller, Robin Peterson, Ryan McLaren, Lonwabo Tsotsobe, Morne Morkel, Farhaan Behardien
Brief scores
South Africa 223/7 (Miller 85*, Mendis 3-35)
Sri Lanka 167 (NLTC Perera 65, Tsotsobe 4-22, Behardien 3-19)
Result South Africa won by 56 runs
MOM David Miller (South Africa)