The Africans bowling attack was led by Shaun Pollock who grabbed two big wickets as his side rallied to defend a modest total of 219-9 as they dismissed Sri Lanka for 141.
Man of the match Pollock ripped through the Sri Lankan top order as he bowled his 10 overs in one spell and finished with the figures of 2-21, his 21 runs with the bat also gave his side a defendable target after a middle order collapse.
He was ably supported by fast bowlers Andre Nel (3-41) and Makhaya Ntini (2-24) as the Proteas claimed their first win of the tournament.
They will now face Pakistan in their final group match on Friday.
Sri Lanka have finished with one victory and will need a string of results to go their way in order to advance.
Put in to bat, South Africa were in trouble early at 30-3 before AB de Villiers (54) and Jacques Kallis (43), steadied the ship and added 80 for the fourth wicket.
They managed to cross the 200-mark, thanks to a rollicking stand between Robin Peterson (22) and Pollock who plundered 32 runs in the last two overs.
Fast bowlers Lasith Malinga (4-53) and Chaminda Vaas (2-16) did the maximum damage. They received valuable support from left-arm spinner Sanath Jayasuriya, who finished with 2-36.
But when they set out to chase the target, Sri Lanka had the same problem with pace as Pollock, Ntini and Nel all combined to have them under all sorts of pressure at 34-4.
A run-out was the last thing Sri Lanka needed at this stage and they virtually lost the match when well-set skipper Mahela Jayawardene fell short of the crease after scoring a neat 36, joint top-scorer with Tillakaratne Dilshan.
South Africa then made short work of Sri Lanka’s lower-order batting, with Vaas (29 not out) alone offering resistance.