Cristiano Ronaldo scored twice to hand Portugal a 2-1 win over the Netherlands and a spot in the quarter-finals of Euro 2012.
Rafael van der Vaart scored first for the Dutch on 11 minutes in the final Group B game at the Metalist Stadium in Kharkiv.
Ronaldo struck 17 minutes later to put the teams level.
The Real Madrid striker became the hero on 74 minutes when he hit the winner to send his side through to the last eight and in the process eliminate the Netherlands.
Joining Portugal in the quarters are Germany who beat a stubborn Denmark side 2-1 in Lviv.
Lukas Podolski netted the first on 19 minutes to mark his 100th appearance for the Nationalmannschaft in style.
Denmark’s Michael Krohn-Dehli levelled matters in the 24th minute with his second goal of the tournament.
But with just ten minutes left substitute Lars Bender struck to send his team into the next round and Denmark home.
Germany go through as Group B winners setting up a quarter-final with 2004 champions Greece while Portugal advance as runners up and for a place in the semis will face the Czech Republic on Thursday.