England rode their luck to top Euro 2012 Group D as they beat co-hosts Ukraine 1-0 while France also made it despite being outclassed in a 2-0 defeat by already eliminated Sweden.
A goal by the recalled Wayne Rooney - thanks to a howler by the Ukrainian goalkeeper - was enough for England although Ukraine were desperately unlucky not to be level when the ball clearly crossed the line but the fifth official didn't see it.
France were woeful as they saw their 23 match unbeaten run under Laurent Blanc brought to an end with a stunning bicycle kick by Zlatan Ibrahimovic and one from the outstanding Sebastian Larsson.
Victory gave the Swedes their first win over the French in almost 43 years, dating back to October 1969.
England's win sees them avoid defending champions Spain and instead they will play Italy in their quarter-final in Kiev on Sunday while it is the French who will face the Spanish in Donetsk on Saturday.
A 48th-minute header from the talismanic Rooney gave the English some breathing space over a Ukrainian side - shorn of its own talisman Andrei Shevchencko, who was unable to start as he was injured - that had to win to go through.
They thought they had at least got back on level terms when Marko Devic had a clear goal wrongly disallowed on 62 minutes.
Devic had powered into the box and his looping shot had flown over keeper Joe Hart towards goal.
John Terry launched himself into an acrobatic clearance to hook the ball away but despite furious Ukrainian appeals no goal was given.
Television replays, however, showed the ball had crossed the line by several inches but had incredibly been missed by the additional assistant referee stationed behind the goal.
"We had our bit of luck tonight (the goal that wasn't allowed) but you deserve some luck," mused England coach Roy Hodgson, who is yet to be beaten in five games since he took over.
However, Hodgson said that his relatively inexperienced team, shorn of several key players through injury before the tournament, had shown great character to prevail.
"It was a very good defensive and disciplined performance," he said.
"We could have shown some more composure on the ball but we are a fledgling team and we can work on that part."
France rarely looked like they were up for the battle and Sweden were the side that looked to be the one who had a chance of reaching the quarter-finals rather than taking an early flight home.
The defeat left Blanc seething, questioning the commitment of his players and clearly hinting that changes would be made for the clash with Spain.
"Sweden played this match with its heart. Physically, they were better prepared and (in Ibrahimovic) they had a player in the team who made the difference, which makes a hell of a difference.
"We are really disappointed by this result but we were in trouble throughout the match. When you lose a match, it is because you have not got the right team out there.
"Therefore, if I were to start it all over, we would not start with the same team."