German defender Lars Bender scored a clinical late goal to give his team a workmanlike 2-1 win over Denmark on Sunday and secure top spot in Euro 2012 Group B.
Germany, who looked comfortable throughout and finished with the maximum nine points, will play Greece, runners-up in Group A, in the quarter-finals after winning all three group games at the European Championship for the first time.
Denmark failed to qualify, losing out to Portugal who beat the Netherlands 2-1 and will meet the Czech Republic in the last eight.
Bender, replacing the suspended Jerome Boateng in his first international start, benefited from poor Danish defending to run on to a pass from Mesut Ozil and calmly slot home from close range in the 80th minute.
"It is something special for me," Bender said. "It's a wonderful present to come in top in this group.
"There were positive spirits out there tonight. We were focused on getting a goal. It was a bit of luck that the ball came to me but you don't think a lot about it, you just shoot it in."
Lukas Podolski scored his 44th international goal in his 100th match in the 19th minute, smacking the ball into the net after a cross hit the boot of team mate Mario Gomez fell perfectly into his path some 10 meters out.
Michael Krohn-Dehli leveled for Denmark in the 24th minute with his second goal of the tournament, nodding in unmarked after German defender Mats Hummels failed to cut out a header into the danger zone from Nicklas Bendtner.
The Danes, who needed to win to go through, could have taken the lead in the 51st minute but Jakob Poulsen shaved the post from 10 meters after great set-up play from Bendtner, who was one of Denmark's best players in the tournament.
Denmark did little else to threaten the German goal and could easily have lost more heavily had Podolski, Thomas Mueller and in particular Sami Khedira converted presentable first-half chances.
Man-of-the-match Podolski, 27, became the youngest European player to win 100 caps for his country.
Germany had the better of the first half and could have scored in the sixth minute when Mueller scuffed a shot from close range which keeper Stephan Andersen had to scramble to save.
"The coach put his faith in me and I was relatively relaxed about it all," Bender said.
"I'm happy that I got to play tonight and crowned it was a goal is a great present for me. The important thing is that the team continues playing successfully and I'm happy to play."
Krohn-Dehli said he was proud of Denmark's performances.
"I am very disappointed like the rest of the team but I'm of course proud and I think we had something to offer," he said.
"It was a difficult game and Germany came with a lot of power. They are a good team and it's too bad we couldn't play against them."
(Editing by Ed Osmond)