England made sure of a T20 World Cup semi-final place and took Australia through with them as South Africa went out in a blaze of glory in Sharjah.
The South Africans piled up 189-2 as Rassie van der Dussen plundered 94 from 60 deliveries and Aiden Markram cracked 52 from 25 balls, and they sealed a 10-run win on the back of a final-over hat-trick from Kagiso Rabada.
South Africa's hefty total meant England needed 87 to be sure of a semi-final place, with Eoin Morgan's team's net run rate sky-high coming into this game after four successive wins. Such calculations told South Africa they had to limit their opposition to no more than 131, if the Proteas were to squeeze Australia out of the final four, but England soon scotched those hopes.
Even as their tournament hopes were dashed, South Africa found focus, limiting Group 1 winners England to 179-8 in an absorbing finish capped by Rabada's feats.
Jos Buttler, England's star man in their early games, fell for just 26, and opener Jason Roy retired hurt, his prospects for the rest of the tournament in the balance after he suffered a calf muscle injury when setting off for a single.
England were soon past their primary target. Moeen Ali clattered Tabraiz Shamsi onto the stadium roof from the first ball of the 13th over, but he fell to the next delivery, looking to go deep again but holing out for 37 to David Miller at long-on.
Liam Livingstone flogged Rabada out of the ground for a 112-metre six, the longest in the tournament so far, and repeated the treatment from the next two balls as England officially condemned South Africa to their exit.
David Malan fell for 33 and England, effectively five wickets down, required 45 from 22 deliveries. Livingstone went for 28 from 17 balls, and England needed 14 from the final over. Rabada had Chris Woakes, Eoin Morgan and Chris Jordan caught in the deep from the first three deliveries and made sure there was no way back from that.
Quinton de Kock (34) had earlier helped South Africa make a strong start. Van der Dussen lashed Woakes for two successive sixes at the start of the 16th over, with Markram following suit from the fifth ball as the England seamer suffered.
The maximums kept coming, with Van der Dussen hitting six in all and Markram blasting four, both batters hitting Jordan over the rope in the final over, but home beckons for the South Africans.
VAN DER DUSSEN TOPS PROTEAS BEST
Van der Dussen's bravura knock was the highest score by a South Africa player in T20 World Cup history, surpassing the 90 not out by Herschelle Gibbs against West Indies at the 2007 tournament.
KNOCKING WOOD TO ALL CORNERS
Mark Wood's first appearance for England in this tournament was not one he will look back on too fondly, given the England paceman conceded 0-47. In his 18th T20I appearance, this was just the second time when he has failed to take a wicket. The other occasion saw him return 0-53 when England lost a series decider to India in Ahmedabad in March.