England remained on course for a place in the knockout rounds of Euro 2012 after coming from behind to send Sweden crashing out of the tournament with a 3-2 victory.
Manchester United striker Danny Welbeck scored a well-taken winner for England in the 78th minute after the introduction of substitute Theo Walcott swung a see-saw Group D battle back in his side's favour.
England had got off to a dream start when recalled striker Andy Carroll headed them into a 23rd-minute lead.
But an own goal from Glen Johnson on 49 minutes followed by a header from Olof Mellberg in the 59th minute threatened to set up a disastrous night for Roy Hodgson's side.
However, the substitution of James Milner for Walcott changed the game. The Arsenal winger lashed in a 64th-minute equaliser to make it 2-2 and then provided the run and pass which set up Welbeck's winner.
Hodgson praised the way his side had fought back to win after trailing early in the second half.
"It was a cracking game of football. We were reasonably comfortable at half-time and had a good control of the game before they rocked us on our heels," Hodgson said.
"We knew how dangerous they were from set-pieces and they proved true to that. But it was very good the way the team responded to that.
"It's difficult at this level, we're playing against good teams. Our attacking play showed good intentions and we looked dangerous."
But Sweden counterpart Erik Hamren was disconsolate after watching his side go out.
"I feel really bad for the players," Hamren said. "They played a really good match but went out. The operation went well but the patient died. That's how I feel today," he said.
England's first ever competitive victory over the Swedes means they will qualify for the quarter-finals with only a point in their final group game against co-hosts Ukraine in Donetsk next Tuesday.
However, Hodgson will want to see a marked improvement from his side if they are to secure the draw they need after a performance littered with errors and shaky defending.
England had started positively, Scott Parker forcing a fine save out of Andreas Isaksson after only seven minutes with a fine swerving effort from 20 yards that the Swedish keeper parried to safety.
Sweden meanwhile had to wait until 20 minutes before threatening the England goal, captain Zlatan Ibrahimovic letting fly with a long range shot that was blocked comfortably by Joe Hart.
For a while it looked as if England's familiar failings of conceding possession too cheaply and poor delivery would be costly.
Captain Steven Gerrard had clearly seen enough on 23 minutes.
Seizing possession in midfield the England skipper looked up to curl in a pinpoint long-range diagonal ball which the twisting Carroll met with a thunderous header that gave Isaksson no chance.
Sweden were forced to look for openings on the break and threatened to score when Ibrahimovic dispossessed the careless Johnson and played in Kim Kallstrom whose shot flew over.
England's positive first half display came unstuck, however, within five minutes of the restart as a rejuvenated Sweden dominated play.
The equaliser came after an Ibrahimovic free-kick bounced back off the wall and was played back to an unmarked Mellberg being played onside by Johnson.
The bearded centre-half's shot beat Hart and Johnson was unable to scramble out of his own net. Mellberg claimed it, but the equaliser was ruled an own-goal by Johnson.
England were rocking and it got worse for Hodgson's men on 59 minutes as Sweden went 2-1 up. Sebastian Larsson swung in a curling free-kick and shambolic defending in the England defence allowed Mellberg to nod home Sweden's second.
Milner, who had capped a poor evening by conceding the free-kick which led to Sweden's second, was then promptly hauled off for Walcott.
The Arsenal winger made an immediate impact and within minutes England were level, Walcott's shot from just outside the area catching Isaksson off-balance to make it 2-2.
But two minutes later Walcott rescued England again, darting into the box with an electrifying burst to cross for Welbeck, who flicked in a deft finish with the back of his heel to make it 3-2.