Sri Lanka levelled their one-day international series with South Africa after a 87-run win in Pallekele.
The hosts chose to bat with man of the match Tillakaratne Dilshan making 86 in their total of 267.
South Africa were dismissed for 180 in their reply despite a century from Hashim Amla.
Veteran opener Dilshan hit nine boundaries in his 90-ball innings to guide Sri Lanka to a formidable total.
He shared a 62-run partnership for the third wicket with Lahiru Thirimanne (36) before departing in the 31st over.
Mahela Jayawardene (48), captain Angelo Mathews (34) and Ashan Priyanjan (25) all offered middle-order support before Ryan McLaren took three wickets in an over as Sri Lanka were all out four balls short of their allocation.
|Sri Lanka: 267 all out (49.2 overs)|
|K Perera||c Amla||b Philander||7||16||9|
|Sangakkara||c de Kock||b M Morkel||7||26||9|
|Thirimanne||c Amla||b Tahir||36||58||49|
|M Jayawardene||b Tahir||48||90||70|
|Mathews||c de Kock||b McLaren||34||71||38|
|Priyanjan||c Duminy||b McLaren||25||19||15|
|Kulasekara||c AB de Villiers||b McLaren||0||2||4|
|A Mendis||c de Kock||b McLaren||2||6||6|
|Malinga||c M Morkel||b Philander||2|
|Extras||2nb 9w 1b 1lb||13|
South Africa were well placed in their reply at 101-2 in the 20th over before a dramatic collapse.
Captain AB de Villiers was dismissed by Dilshan for 29 before the next four men fell in single figures.
Amla played superbly in hitting 101 from 102 balls but only de Villiers and Dale Steyn reached double figures as the hosts were dismissed in the 39th over.
|South Africa: 180 (38.1 Overs)|
|Amla||c Senanayake||b Malinga||101||157||102|
|de Kock||b Malinga||4||9||6|
|Kallis||c Sangakkara||b Malinga||1||12||7|
|AB de Villiers||c Sub||b Dilshan||29||56||41|
|Duminy||c Sangakkara||b A Mendis||1||3||4|
|Miller||c Senanayake||b Dilshan||4||6||8|
|McLaren||c Kulasekara||b Senanayake||3||14||17|
|Philander||c Sangakkara||b Dilshan||1||4||5|
|Steyn||lbw||b A Mendis||23||51||35|
|M Morkel||b Malinga||0||2|
|Extras||0nb 9w 0b 4lb||1|
De Villiers was philosophical at the awards presentation as reported by ESPN Cricinfo.
Thought we started really slowly with the ball. Still in with a chance. We pulled it back to 260 from 300 and above. Hash played an amazing innings and not enough partnerships around him. I got out to a soft dismissal. Dale showed that if you spent enough time you could do. I got out but there are other batsmen too.
Mathews admitted he was nervous after losing a flurry of late wickets.
I was a bit concerned after we collapsed, thought 30-40 runs short. Dilshan played a great knock. All spinners contributed. We knew the South Africans were coming hard at us. Looking forward to the third game.
The Proteas won the opening game of the series by 75 runs in Colombo on Sunday. The series decider will be in Hambantota on Saturday.