South Africa saw off a spirited fightback from Afghanistan to win by five wickets in their final World Cup group game and consolidate second place in the standings.
The Proteas have 14 points from their nine games, two points ahead of Australia who play Bangladesh on Saturday. Both South Africa and Australia have already qualified for the semi-finals.
Afghanistan wrapped up their best ever World Cup campaign with four wins and also sealed a place in the Champions Trophy.
The Asian side opted to bat first and posted 244 in 50 overs on the back of Azmatullah Omarzai's unbeaten knock of 97, which included seven boundaries and three sixes, while Gerald Coetzee was the pick of the South African bowlers with figures of 4-44.
In response, South Africa opener Quinton de Kock set up the chase with a breezy 41 that took him to the top of the tournament's scoring charts on 591 runs.
Rassie van der Dussen (76 not out) then guided the Proteas home, stitching together a 65-run partnership with Andile Phehlukwayo (39 not out), who smashed the winning runs with a massive six over deep mid wicket in the 48th over.