Tillakaratne Dilshan’s fine all-round performance levelled the three-match one-day international series between Sri Lanka and South Africa as the hosts secured an 87-run victory in Pallekele.
Dilshan top-scored for the home team with 86 before taking 3-40 as South Africa were skittled out for 180 in reply to 267.
Hashim Amla struck his second consecutive century and his 14th in ODI cricket but his team-mates were unable to linger long enough to challenge the Sri Lanka total.
Dilshan got off to a flier with some innovative shots and was well supported in the middle overs by Lahiru Thirmanne and Mahela Jayawardena against a South Africa attack deprived of the skills of Dale Steyn, who had to leave the field with a hand injury after just 14 balls.
Some late hitting by Angelo Mathews and Ashan Priyanjan pushed the hosts' score up to 267 with Ryan McLaren taking 4-48.
In the reply Lasith Malinga reduced the Proteas to 26 for two inside five overs, but Amla and his captain AB de Villiers added 75 as they looked to be well placed for an assault on the target.
The spin of Dilshan and Ajantha Mendis proved to be too much for the batsmen, however, and they collapsed from 101 for two to 127 for seven to all but decide the game.
Amla, who hit 109 in the first match on Sunday, reached his quickest century to date but was soon out for 101 as South Africa lost their last three wickets for no runs to finish 87 runs shy.