Semi-final of Cricket World Cup 2019. Photograph:( WION Web Team )
Had Australia won, they would have faced fourth-placed New Zealand in the first semi-final at Old Trafford on Tuesday
Australia will play England in the World Cup semi-finals after the holders suffered a dramatic 10-run defeat against South Africa at Old Trafford on Saturday.
David Warner marked his first match against South Africa since a 12-month ball-tampering ban with his third hundred of the World Cup, but it was not enough to prevent Australia suffering their second loss of the 10-team group stage.
Defeat on the penultimate ball meant Australia, who had already qualified for the semi-finals, failed to clinch top spot as India leapfrogged them to take pole position after beating Sri Lanka earlier on Saturday.
Had Australia won, they would have faced fourth-placed New Zealand in the first semi-final at Old Trafford on Tuesday.
But instead they will play resurgent hosts England in the second semi-final at Edgbaston on Thursday.
The final is at Lord's a week on Sunday.
Warner (122) and Alex Carey (85) got Australia to within sight of a stiff target of 326 during a fifth-wicket partnership of 108.
But neither could see their side home to victory after South Africa captain Faf du Plessis made 100 and Rassie van der Dussen a career-best 95 in a total of 325-6.
Australia were struggling at 119 for four and Warner could only watch as wickets fell early against a Proteas side whose own semi-final hopes had long since disappeared.
Australia captain Aaron Finch, Warner's opening partner, went for three, when he chipped Imran Tahir to short cover, sparking a typically exuberant celebration from the bowler.
Steve Smith, who like Warner was given a 12-month ban for his part in the ball-tampering scandal during a Test in Cape Town last year, fell lbw for seven to Dwaine Pretorius.
Warner held firm, going past 600 runs for the tournament, with his latest century coming up in 100 balls when he edged Chris Morris for his 12th four.
He was eventually out when a drive off Dwaine Pretorius was well caught by a diving Morris at mid-on.
Carey, however, launched Tahir for six during his career-best ODI knock before his 69-ball innings ended when he carved Morris to Aiden Markram at deep cover to leave Australia 275-7 in the 46th over.
Usman Khawaja returned after retiring hurt earlier in the innings and helped get the target down to 25 off 12 balls before he was bowled for 18, walking across his stumps, by Kagiso Rabada.
The target eventually became 18 off a nail-biting last over -- bowled by Andile Phehlukwayo -- with one wicket standing.
And with 11 needed off two balls, last man Nathan Lyon holed out to Markram in the deep.
Earlier, Mitchell Starc equalled Australia legend Glenn McGrath's World Cup tournament record of 26 wickets, set at the 2007 event in the Caribbean, with a return of 2-59.
Markram (33), opening after South Africa veteran Hashim Amla was ruled out with a knee injury playing football in a warm-up on Friday, and Quinton de Kock (52) set the tone in front of a sun-drenched crowd in a first-wicket stand of 79.
Du Plessis, who drove fast bowler Pat Cummins for a superb six, completed the first hundred by a South African at this World Cup in 93 balls.
But he was out to the next ball he faced, slicing Jason Behrendorff to third man.
Van der Dussen fell short of his maiden ODI hundred when, trying to hit the last ball of the innings for six, he holed out off Cummins.