VB Series, Perth: South Africa 224-5 (45.1 overs) beat Sri Lanka 221 (47.4 overs) by five wickets
South Africa moved to the verge of the VB Series finals after beating Sri Lanka by five wickets in Perth.
Smith's off-spin brought three wickets in the middle of the innings
Captain Graeme Smith took three wickets as the Proteas bowled Sri Lanka out for 221 in Perth and then hit 40 - his highest score of the whole tour so far.
Boeta Dippenaar continued his fine form with 87 from 94 balls and South Africa got home with 29 balls to spare.
Sri Lanka had reached 137-1 before Sanath Jayasuriya (86) became the first of seven wickets to fall for 45 runs.
Sri Lanka now need South Africa to lose their two matches against Australia this week, which would turn a repeat of this match in Hobart on 7 February into a final play-off.
If they win one of those remaining three games, Smith's men will meet Australia in the best-of-three finals series, beginning in Adelaide on 10 February.
Sri Lanka at least denied their rivals a bonus point, with four of the wickets to fall coming as they tried to clinch victory before the required 40-over deadline.
Dippenaar was unlucky to be given out caught behind off Muttiah Muralitharan, when replays showed he had not got an edge to a leg-break.
He had already survived a drop at mid-on trying to loft the spinner out of the ground for the second time in an over.
Muralitharan had Smith caught behind after an opening stand of 84 and bowled Herschelle Gibbs for figures of 3-44.
Jacques Rudolph and Justin Kemp were both stumped attempting to slog Malinga Bandara.
But Mark Boucher, who finished 30 not out, and Ashwell Prince, with an unbeaten 20, saw them home at a more sedate pace.
Sri Lanka had looked well set after winning the toss as openers Jehan Mubarak (31) and Jayasuriya put on 94 together before Smith bowled Mubarak in the 16th over.
Jayasuriya smashing three sixes and nine fours in a stay of just 65 balls before chopping Smith to point to trigger the collapse.
Sri Lanka coach Tom Moody was livid at the failure of his middle order.
"That was a diabolical collapse - probably the worst collapse I have ever experienced and it was unacceptable," he said.
"You can't expect to win international matches that way."
Seamer Shaun Pollock was rewarded for an economical performance with late wickets to finish with 2-17 from his 10 overs.
Tillakaratne Dilshan held the lower order together with 37 but he was the last wicket to fall, victim of the third run out of the innings, with 14 balls remaining.
Sri Lanka took emergency action with eight wickets down in the 39th over, bringing super-sub Bandara in for seamer Dilhara Fernando.
He shared a 34-run ninth-wicket stand, contributing a six off Charl Langeveldt, but was victim of a run out looking for a second run late on.
Man of the match Smith said his bowling had become more important with new rules and injuries.
"With losing Jacques Kallis we've lost a bit of balance and the fifth bowler role becomes important, especially if our super-sub is a bowler," he said.
"I've been working hard in the nets because we are a bowler short if we lose the toss.
"It was a bit hair-raising - I was looking at 300 at one stage - but with Sri Lanka a wicket in the middle can turn things around."