Faf du Plessis and Hashim Amla struck unbeaten half-centuries as South Africa cruised to a nine-wicket victory at the Riverside Ground in Durham to put a major dent in Sri Lanka's hopes of reaching the Cricket World Cup semi-finals.
After putting Sri Lanka in to bat, South Africa were set a target of 204 as seamer Dwaine Pretorius took 3-25 off 10 overs in an innings that was interrupted by a swarm of bees that invaded the pitch and sent the players and umpires to the floor.
After the early loss of Quinton de Kock, already-eliminated South Africa never looked troubled as Amla (80 not out) and Du Plessis (96 not out) put on 175 for the second wicket, reaching their target with 76 balls remaining.
Sri Lanka needed victory to move level with fourth-placed England in the race for semi-final places, but struggled with bat and ball against an opponent who have now beaten them in 17 of their last 19 meetings.
"It's been a long time coming," South Africa captain Du Plessis said of his side's second win of the tournament.
"We finally did ourselves justice with the talent we have in the dressing room. But it feels bittersweet, it doesn't feel like it means so much because it has come too late.
"We showed the basics of batting, we have not had guys score big runs and build partnerships by going all the way through the innings. It made a huge difference today."
Sri Lanka produced a fast start to their innings that was halted by the immaculate line and length of Pretorius as South Africa limited their opponents to 203 all out three balls shy of 50 overs.
After overcoming the loss of captain Dimuth Karunaratne with the first ball of the match, Kusal Perera (30) and Avishka Fernando (30) raced to 67 inside the first 10 overs, taking the attack to the South Africans.
But Pretorius picked up both their wickets and slowed the run-rate, with seamer Chris Morris (3-46) also collecting key scalps, including that of Angelo Mathews (11).
De Kock (15) struck three crisp fours before he was bowled by the wily Lasith Malinga (1-47), but Amla and Du Plessis played a patient game and nudged the ball for singles and twos.
Amla took 56 balls for his half-century and Du Plessis 70, but they were always ahead of the run-rate.
They sped up when the target narrowed to under 30, but Du Plessis ran out of runs to reach a deserved captain's ton.
"All departments went wrong, especially the batting," a rueful Karunaratne said. "We struggled to even get singles and that was key. You get put under pressure and start going for big shots.
"The wicket was a bit slow but they bowled really well. We could not build the same pressure."
Sri Lanka must win their final two games and hope other results go their way if they are to reach the semi-finals.
"We have to win our matches against West Indies and India. We will keep our heads up and keep going. It is the only thing we can do."