Tillakaratne Dilshan outshone Hashim Amla's 14th One-Day International 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.
Scorecard
Sri Lanka
K Perera c Amla b Philander 7
T Dilshan b Duminy 86
K Sangakkara c de Kock b Morkel 7
L Thirimanne c Amla b Tahir 36
M Jayawardene b Tahir 48
A Mathews c de Kock b McLaren 34
A Priyanjan c Duminy b McLaren 25
N Kulasekara c de Villiers b McLaren 0
S Senanayake not out 9
A Mendis c de Kock b McLaren 2
L Malinga c Morkel b Philander 0
Extras: (B-1, LB-1, W-9, NB-2) 13
Total: (all out in 49.2 overs) 267
Fall of wickets: 1-26, 2-63, 3-125, 4-154, 5-225, 6-256, 7-256, 8-256, 9-266, 10-267
Bowling: Steyn 2.2-0-19-0, Philander 7.2-1-49-2, Duminy 9.4-0-50-1, Morkel 10-0-58-1, McLaren 10-0-48-4, Tahir
10-1-41-2.
South Africa:
H Amla c Senanayake b Malinga 101
Q de Kock b Malinga 4
J Kallis c Sangakkara b Malinga 1
AB de Villiers c sub b Dilshan 29
J Duminy c Sangakkara b Mendis 1
D Miller c Senanayake b Dilshan 4
R McLaren c Kulasekara b Senanayake 3
V Philander c Sangakkara b Dilshan 1
D Steyn lbw b Mendis 23
M Morkel b Malinga 0
I Tahir not out 0
Extras: (lb-4, w-9) 13
Total: (all out; 38.1 overs) 180
Fall of wickets: 1-9, 2-26, 3-101, 4-104, 5-109, 6-124, 7-127, 8-180, 9-180, 10-180
Bowling: Malinga 6-1-24-4, Kulasekara 5-0-39-0, Senanayake 7-1-36-1, Mathews 3-1-11-0, Mendis 6.1-2-18-2, Dilshan 10-0-40-3, Priyanjan 1-0-8-0.
Image: Sri Lanka's captain Angelo Mathews (third from right) and Tillakaratne Dilshan (second from right) celebrate with teammates the dismissal of South Africa's David Miller during their second One-Day International in Pallekele on July 9.
Photograph: Dinuka Liyanawatte/Reuters