The Danes were eliminated after the two teams finished their Group B campaigns.
Lukas Podolski opened the scoring for Germany in the 19th minute and Lars Bender slotted home the winner in the 80th after Michael Krohn-Dehli had equalized for Denmark in the first half.
“It’s absolutely a day of joy,” Bender said. “I’ll be thinking back to this day a long, long time. We have a positive spirit in the team.”
Germany played without flair, but controlled possession and was never really challenged by the Danes, who go home after stunning the Netherlands in the first match but losing to Portugal in the second.
“We can be satisfied with our effort but not with the result,” Denmark midfielder William Kvist said. “I think we proved that we can play against the big teams. We won (against the Netherlands) and we didn’t lose big. We showed that we can play against the best.”
Germany finished top of the group with a perfect record of three wins and now faces Euro 2004 champion Greece on Friday in Gdansk.
PORTUGAL 2, NETHERLANDS 1
In Kharkiv, Ukraine, Cristiano Ronaldo finally found the form he was lacking at the European Championship, scoring twice to give Portugal a win over the Netherlands and a spot in the quarterfinals.
The Real Madrid forward failed to sparkle in Portugal’s two previous matches but he was devastating against the Dutch. He produced an equalizer with his first goal of the tournament in the 28th minute and scored the winner in the 74th.
“Ronaldo got so much criticism in the last game and he is back now,” Netherlands coach Bert Van Marwijk said. “That is how fast things can change.”
Needing a win to have a chance at staying in the tournament, the disappointing Dutch fielded an impressive attacking lineup featuring Klaas-Jan Huntelaar and Robin van Persie up front, but it wasn’t enough to keep them at Euro 2012.
“We started quite well but we were playing against one of the better teams today,” Rafael van der Vaart said. “We lost three times. We were bad and we don’t deserve to go through.”
The Dutch lost in the World Cup final to Spain two years ago and, with stars like Van Persie, Arjen Robben and Wesley Sneijder, had anticipated a strong run at Euro 2012.
Instead, it will be Portugal in the quarterfinals facing the Czech Republic on Thursday in Warsaw.
“It won’t be easy. We’ll have to be this good again to reach the semifinals,” Portugal coach Paulo Bento said.