South Africa has claimed 4-29 off 30 balls late in Sri Lanka's innings for a nine-run win at Adelaide Oval in a thrilling finish to game six of the VB Series.
Sri Lanka managed 254-8 in response to South Africa's 263-5 in an entertaining struggle in front of a crowd of 8130.
A superb, run-a-ball fifth-wicket stand of 107 between Tillakaratne Dilshan and Mahela Jayawardene seemed likely to heave Sri Lanka to victory, but the Proteas persisted admirably and the four points for the win gave them eight in the triangular competition - two behind Australia and one behind Sri Lanka. Each team has played four of its eight qualifying matches.
Dilshan fashioned a fine, unbeaten 82 off 108 balls and Jayawardene hurried to 52 off 52 balls.
Sri Lanka was 224-5 off 44.1 overs when Jayawardene was bowled, via an inside edge, by Johannes van der Wath, 242-7 off 47.3 overs when Russel Arnold (11) was bowled by Andrew Hall and Malinga Bandara (0) was run out first ball by Hall, and 253-8 off 49 overs when Chaminda Vaas (9) was caught at long on by Johan Botha off Shaun Pollock.
Muttiah Muralitharan and Dilshan needed 11 off the last over - from Hall - but mustered only one - a leg bye off the third ball when Muralitharan was facing.
Left-handers Sanath Jayasuriya and Kumar Sangakkara boosted Sri Lanka's early hopes with a second-wicket partnership of 57 off just 49 balls, but their dismissals in the 13th and 15th overs left Sri Lanka struggling at 68-3.
Jayasuriya was stumped smartly on the legside by Mark Boucher off medium-pacer Hall after hammering two sixes and four fours in his 31-ball 37 and Sangakkara hit a return catch off van der Wath's slower ball after collecting four fours in his 31-ball 23.
Dilshan and skipper Marvan Atapattu figured in a fourth-wicket union of 49 off 72 balls, but Boucher's brilliant run out of Atapattu (23), after appealing originally for a catch off Botha, reduced Sri Lanka to 117-4 in the 27th over.
Earlier, Pollock celebrated his 246th ODI for South Africa - one more than Jonty Rhodes' record - by having Jehan Mubarak (4) caught at mid-wicket by Ashwell Prince in the fifth over.
Man-of-the-match Boeta Dippenaar's determined, unconquered 125 - the highest of his three centuries in 90 ODIs - and Herschelle Gibbs' aggressive 68 helped sweep South Africa to its competitive total.
Dippenaar, who hit only seven fours in his cleverly controlled, 145-ball hand, and Gibbs shared a run-a-ball fourth-wicket stand of 119 to reinforce the Proteas' innings from 101-3 off 25.5 overs.
Gibbs departed in the 46th over, bowled sweeping at Ruchira Perera, after having crashed three sixes and four fours in his 65-ball 68.
South Africa was 220-4 and Dippenaar and Pollock (8) pounded 29 off 19 balls until Pollock was caught by a diving Atapattu at extra cover off Nuwan Kulasekera, then Dippenaar and Justin Kemp (6no) took 14 off the last eight balls.
Graeme Smith, who won the toss in fine, warm conditions, scored 39 of an opening partnership of 72 off 18.2 overs with Dippenaar before being stumped by Sangakkara off Muralitharan's second ball.
Van der Wath, promoted to No.3 from the lower order, was caught bat-pad at forward short leg by Arnold off Muralitharan's next ball, and Jacques Rudolph (11) was caught and bowled by Dilshan off a bottom edge in the 26th over.