BBC Sport explains the qualification permutations as Euro 2012 enters the final set of group stage games.
If two or more teams are equal on points on completion of the group matches, the following criteria are applied, in the order given; to determine the rankings:
• (a) higher number of points obtained in the matches among the teams in question
• (b) superior goal difference in the matches among the teams in question
• (c) higher number of goals scored in the matches among the teams in question
• (d) If, after having applied criteria a) to c), two of those teams still have an equal ranking, criteria a) to c) are reapplied exclusively to the matches between the two teams in question to determine the final rankings of the two teams. If this procedure does not lead to a decision, criteria e) to i) apply in the order given
•(e) superior goal difference in all the group matches
•(f) higher number of goals scored in all the group matches
•(g) if the two teams have played each other in the final group game, the team to progress would be decided on penalties. Otherwise it comes down to the Uefa national team coefficient ranking system
•(h) fair play conduct of the teams (final tournament)
•(i) drawing of lots.
Group winners - Czech Republic
Needed victory against co-hosts Poland to secure qualification. Petr Jiracek's second-half strike clinched a 1-0 win in Wroclaw and ensured the Czechs advanced to the last eight as group winners.
Second qualifying spot - Greece
Captain Giorgos Karagounis scored in first-half stoppage time as the Euro 2004 winners, who knew they could only progress with a win, beat Russia in Warsaw. Victory meant they qualified at the expense of Russia courtesy of their better head-to-head record.
Eliminated - Russia and Poland
Group winners - Germany
Joachim Loew's team knew a win against Denmark would secure quarter-final qualification and top spot in Group B. Goals from Lukas Podolski and Lars Bender in their 2-1 victory in Lviv achieved exactly that.
Second qualifying spot - Portugal
Skipper Cristiano Ronaldo scored twice as Portugal beat Netherlands to join the Germans in the knockout phase. The 2-1 success in Kharkiv, coupled with Denmark's defeat, ensured a safe passage for Paulo Bento's men.
Eliminated - Denmark and Netherlands
Group winners - Spain
Reigning world and European champions Spain needed to beat Croatia to be certain of qualification and top spot. Eventually they managed to break down their stubborn opponents through substitute Jesus Navas's late tap-in. It clinched a 1-0 success in Gdansk and booked a last-eight tie against the Group D runners-up.
Second qualifying spot - Italy
After drawing their opening two games, Cesare Prandelli's team knew they had to win against already-eliminated Republic of Ireland. But the Azzurri also realised a scoring draw between Spain and Croatia was likely to send them home. Goals from Antonio Cassano and Manchester City's Mario Balotelli sealed a 2-0 success in Poznan and, coupled with Spain's win, a quarter-final place.
Eliminated - Croatia and Republic of Ireland
Group winners - England
England needed only a draw against Ukraine to confirm their progress to the last eight but a 1-0 win helped them finish top of Group D. The returning Wayne Rooney got the winner for Roy Hodgson's side as they leapfrogged France to top spot and a quarter-final against italy.
Second qualifying spot - France
France led the group going into a the game against Sweden only to lose 2-0 against a team who had already been eliminated from the tournament. France were disappointing as they went behind to a spectacular Zlatan Ibrahimovic volley before a late goal by Sebastian Larsson confirmed a defeat leaving them to face Spain in the quarter-finals.
Eliminated - Ukraine and Sweden