England 144 for 6 (Hales 49, Stokes 42*) beat Sri Lanka 141 for 8 (Nissanka 67, Wood 3-26) by four wickets
Sydney: England survived a scare to reach the semi-finals of Men's T20 World Cup with a nerve-jangling four-wicket victory over Sri Lanka in Sydney.
Chasing 142 in the win-or-bust match, England were cruising at 75-0 in the eighth over before a collapse of 5-36 put them in peril.
They needed 13 from 12 balls with four wickets in hand but Ben Stokes' calm 42 not out took them to victory with two balls to spare at the Sydney Cricket Ground.
It sets up a semi-final in Adelaide on Thursday, most likely against India, who need to beat Zimbabwe on Sunday.
England also recovered excellently with the ball to restrict Sri Lanka to 141-8 after they raced to 52-1 after five overs.
Adil Rashid expertly halted the scoring and claimed the crucial wicket of opener Pathum Nissanka for 67 from 45 balls in returning figures of 1-16 from four overs.
Mark Wood recovered from conceding 17 in his first over to take 3-26 from three, while Sam Curran was superb for his 1-27.
England's win eliminated hosts and defending champions Australia and kept alive their own bid to win the T20 world title for a second time.
It should have been far easier for England given the roaring start to their chase, but the pressure of the situation, combined with Sri Lanka's clever spinners and a tiring pitch, set up an unexpectedly tense finale.
When Chris Woakes cut seamer Lahiru Kumara towards a vocal section of England fans for the boundary that sealed victory, the relief was palpable.
Captain Jos Buttler added 28 in a thrilling opening stand with Hales, but when he picked out deep mid-wicket off leg-spinner Wanindu Hasaranga the slide began.
Hales toe-ended a sweep to Hasaranga, Liam Livingstone holed out at long-on, Moeen Ali chipped straight to extra cover and Sam Curran hooked to fine leg.
England were also hampered by the loss of Dawid Malan - he did not bat because of a groin injury sustained in the field - but throughout it all Stokes was nerveless.
Although his place in this side has been questioned after one double-figure score in six innings since being recalled to the T20 side, once again he delivered when England needed him most on the big occasion.
He struck only two fours but expertly picked gaps for singles and twos. When he walked from the field he did so with England's fans wildly singing Sweet Caroline at this famous ground.
It means England join New Zealand in the last four and do so with real momentum.