Sri Lanka secured a 2-1 victory in their T20 series with South Africa after a five-wicket win inspired by Niroshan Dickwella in Cape Town.
Man of the match Dickwella plundered 68 from 51 balls, including 10 fours and a six, and shared in a valuable 71-run third-wicket stand with Dhananjaya de Silva as Sri Lanka overcome the hosts' 169 for five.
De Silva was the more passive partner, making just 19, and it fell to Seekkuge Prasanna and Asela Gunaratne to finish the job, with the tourists taking the spoils with only one ball remaining.
The hosts appeared to have the advantage once left-handed opener Dickwella was caught by Farhaan Behardien off Imran Tahir, who three balls later in the same 16th over had De Silva stumped by Mangaliso Mosehle.
Sri Lanka were then on 118 for four, but after Kusal Mendis soon went cheaply, Prasanna and Gunaratne secured victory with an unbroken stand of 28 from 15 deliveries.
Prasnna hit three fours and three sixes in an explosive innings, finishing unbeaten on 37 from 16 balls, and Gunaratne reached 11 not out from six deliveries, helping Sri Lanka to 170 for five.
South Africa had elected to bat first and posted a reasonable total largely thanks to a half-century from the returning AB de Villiers, back after an elbow injury lay-off.
Making his first international appearance since August 2016, he reached 63 and shared in a second-wicket stand worth 71 runs with Reeza Hendricks.
De Villiers perished when he hit the 44th delivery he faced to Upul Tharanga off the bowling of Nuwan Kulasekara. Hendricks was stumped for 41 by Dinesh Chandimal off the bowling of Lakshan Sandakan.
South Africa, who had won the series' opening game by 19 runs, dropped seven catches to contribute to their defeat.