Tillakaratne Dilshan outshone Hashim Amla's 14th ODI century to steer Sri Lanka to a series-levelling 87-run win over South Africa in the second match at Pallekele Stadium on Wednesday.
Dilshan followed his 90-ball knock of 86 to take three crucial South African wickets for 40 runs and claim the man-of- the-match award.
Sri Lanka, choosing to bat first, were dismissed for 267 in the 50th over with Ryan McLaren causing a late collapse, taking four for 48 as the last six wickets fell for 42 runs.
South Africa were going strongly at 101-2 before Dilshan induced AB de Villiers to miscue a shot and they then collapsed to 180 all out off 38.1 overs on a slow pitch.
Amla was the only batsman untroubled by the Sri Lankan bowlers, scoring his second successive hundred of the series - 101 off 102 balls.
Lasith Malinga was Sri Lanka's best bowler with four for 24.
South Africa won the first ODI played in Colombo on Sunday by 75 runs. The third and final ODI takes place at Hambantota on Saturday.