South Africa have seen off a spirited fightback from Afghanistan to win by five wickets with 15 balls to spare in their final World Cup group game and ensure they'll go into their semi-final against Australia in buoyant mood.
Consolidating second place in the standings, South Africa, who have 14 points from their nine games, are two points ahead clear of Australia and are confident of repeating their group-stage win over Pat Cummins' team in next Thursday's last-four meeting in Kolkata.
"They say winning is a habit so we want to take that momentum through, we take a lot of confidence," South Africa skipper Temba Bavuma said.
"We did something differently today. We normally bat first but we batted second. To get over the line in that manner will give us confidence.
"We'd like to be playing here again in the final in front of a full capacity crowd - but there's a hurdle we have to get over first against Australia in Kolkata."
Against the Afghans on Friday, they again demonstrated what a formidable side they can be, as Australia already know following their 134-run hammering by the Proteas in the match a month ago in Lucknow.
Afghanistan, meanwhile, wrapped up their best ever World Cup campaign with four wins and also sealed a place in the Champions Trophy.
They opted to bat first but failed to build partnerships as South Africa picked up wickets regularly.
The Asian side posted 244 in 50 overs on the back of Azmatullah Omarzai's unbeaten knock of 97, which included seven boundaries and three sixes.
Azmatullah was alone in putting up a fight and the allrounder looked destined for a first ODI century but finished three short as Kagiso Rabada denied him, conceding just three runs in the final over.
Gerald Coetzee was the pick of the South African bowlers with his 4-44 while Quinton de Kock finished with six catches to tie the record for most wicketkeeping dismissals in a World Cup match.
In response, 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 but they were in a spot of bother at 5-182.
But Rassie van der Dussen (76no) guided the Proteas home, stitching together a 65-run partnership with Andile Phehlukwayo, who smashed the winning runs with a massive six over deep midwicket in the 48th over.
"In any chase, there has to be an anchor, we had a lovely platform and that made it easy for me to come in and assess the conditions," van der Dussen said.
"We've seen what our batting line-up can do and we got some good partnerships in the middle there."
Afghanistan skipper Hashmatullah Shahidi said the tournament was a good learning experience as the team, once considered World Cup minnows, delivered some surprise wins.
"We gave a good message to the world, we played big teams and fought till the end," he said.
"I'm proud of what our batsmen did in this tournament. We were struggling before the tournament. It's a positive thing looking to the future.
"Everyone knows we have a good spin department, but if we carry the momentum of what we did with the bat, we will be a very good side."