In front of a capacity crowd at Mount Smart Stadium, in Auckland, England dominated for 72 minutes and then almost threw it away.
England built a 20-0 lead before Tonga scored three converted tries in the final eight minutes to leave Wayne Bennett’s men hanging on.
Led by James Graham, England’s forwards muscled up from the start and, on the back of an outstanding defensive effort, they seemed to be cruising into the final, but Tonga staged a stunning late rally.
There were echoes of four years ago when New Zealand broke England’s hearts with a winning try on the last play of the semi-final.
Tonga almost did the same, but Andrew Fifita lost possession as he looked to be surging over the line with seconds left.
Next weekend will be England’s first World Cup final since 1995 following defeats at the semi-final stage in each of the three previous tournaments.
A strong opening quarter laid the platform for England, who led 12-0 inside 15 minutes.
Huddersfield Giants’ in-form winger Jermaine McGillvary opened England’s account with his 12th try in 11 Tests, after 10 minutes.
James Graham’s inside ball to Gareth Widdop got England on the front foot and then McGillvary crossed for the 10th successive international after slick passing across the line by Luke Gale, Kevin Brown and Widdop.
Widdop added the extras and then scored England’s second try, from Elliott Whitehead’s pass, Brown and Sean O’Loughlin also having handled.
Referee Matt Cecchin thought it was a double-movement, but he was overruled by video assistant Ben Thaler.
The score - converted by Widdop - came moments after Ryan Hall got back to make a try-saving tackle on Michael Jennings following a long-range break by Tonga.
England did not make their first error until the 20th minute. Mistakes crept in after that, but England’s strong defence kept the Tongans out until the break.
Tonga wasted a golden opportunity four minutes into the second half when Daniel Tupou, who had a clear run to the line, spilled Will Hopoate’ pass a few metres out after successive penalties.
England went three scores ahead on 48 minutes through a Widdop penalty goals after the ball was stolen from Sam Burgess and that was to prove crucial.
England seemed to have made the game safe with 14 minutes left when John Bateman powered over from a pass by Widdop, whose conversion made it 20-0.
But their defence finally cracked with eight minutes left when Tevita Pangai Junior touched down from close range.
That looked like a consolation score, but Siliva Havili broke through Chris Hill’s tackle to cross four minutes later and Tui Lolohea surged over in the next set as England’s defence evaporated.
Sio Siua Taukeiaho converted all three and there was drama with seconds left when referee Matt Cecchin ruled Fifita had lost the ball before touching down, despite Tonga’s claims it had been knocked out by Whitehead.