Manchester, July 7: David Warner's superb 122 was in vain as Australia lost a thriller by 10 runs to South Africa, a result that means the Cricket World Cup holders will face England in the semi-finals.
India's defeat of Sri Lanka earlier on Saturday meant Australia had to win in Manchester to avoid the hosts in the last four and instead book a clash with trans-Tasman rivals New Zealand.
But in the final match of the group stage the Proteas produced one of the best team performances of the tournament so far to inflict Australia's second defeat of the competition.
Faf du Plessis made South Africa's first century of the World Cup and his 12th in ODI cricket. The former Lancashire batsman thrived with a masterful round 100 on his return to Old Trafford as South Africa posted an imposing 325 for six.
Rassie van der Dussen (95) almost followed his captain to three figures, trying to heave a six off Pat Cummins' last ball of the South Africa innings, but instead picked out Glenn Maxwell in the deep.
Warner should then have been run out by Kagiso Rabada (3-56) in the first over of Australia's reply - the opener facing South Africa for the first time since last year's ball-tampering scandal - and he seemed set to take full advantage of that lapse.
When Quinton de Kock, who made 52 and ran out Marcus Stoinis, produced a majestic catch off Morris' bowling to remove Maxwell for 12, Australia were 119 for four and heading for an eighth loss in nine ODIs against South Africa, only for Warner and Alex Carey to rebuild.
But a wonderful flying Chris Morris catch saw Warner depart as he looked to find fifth gear and, when explosive wicketkeeper-batsman Carey fell to Morris for a buccaneering 85 off 69 balls, Australia were on the brink of defeat.
Usman Khawaja (18) bravely returned to the crease after earlier retiring hurt with an apparent hamstring injury, but diverted the ball on to the top of the stumps while playing a scoop and South Africa closed out their third win of the World Cup.
STARC ON BRINK OF HISTORY
The leader of Australia's attack was not at his best in Manchester, Mitchell Starc's first ball going for four wides in a wayward opening over that cost 14 runs and gave the Proteas a flying start.
But a yorker that ripped through Dwaine Pretorius' defences gave Starc his 26th wicket of the tournament, moving him level with Australia great Glenn McGrath as the most prolific bowler in a single World Cup.
With at least one knockout match still to play, the 29-year-old is almost certain to sit top of the pile regardless of whether or not Australia successfully defend their title, while his late efforts with the bat - hitting 16 off 11 balls - almost set up an improbable victory.
WARNER PASSES 600 BUT ROHIT LEADS
There is no doubt Warner is having a quite brilliant World Cup - this was his third century - but despite passing 600 runs for the tournament he is second behind India opener Rohit Sharma in the batting tables.
A third century in four ODI appearances against the Proteas was fully deserved as he punished Rabada's mistake and, if Australia are to win the tournament for a sixth time, there is no doubting Warner holds the key.
He will certainly relish a clash with pre-tournament favourites England. That match will take place on Thursday at Edgbaston, where Eoin Morgan's side have a terrific record.
DUMINY TAHIR WAVE GOODBYE
There was a winning farewell for veteran Proteas duo JP Duminy and Imran Tahir as both men played their final ODI matches for South Africa.
Tahir was able to roll out his famous celebration when he claimed the prized wicket of Australia captain Aaron Finch for three but he later missed a caught and bowled chance to remove Carey, which could have proven costly.
Duminy's contribution - scoring only 14 runs and taking no wickets from four overs - was more low-key but the Proteas will miss his all-round efforts as they look to rebuild after an underwhelming World Cup that at least ended on a high.