Michael Ballack's rocket free-kick was enough to beat Austria and ensure qualification for Germany while sending the hosts out of the tournament. Germany coach Jogi Loew watched from the stands after being sent off.
Ballack answered his critics in style with a thundering shot which earned Germany the win
Ballack scored with a spectacular free-kick in the 49th minute to give his side a 1-0 victory in a Group B match played in Vienna and a place in the quarter-finals.
Spanish referee Manuel Gonzalez sent German coach Joachim Loew and his Austrian counterpart Josef Hickersberger into the stands in the first half for arguing with the fourth official.
Germany needed just a draw to join Croatia in the second round, while the co-hosts needed to beat Germany and hope that Croatia would beat Poland in their final game.
But while the Croats, although they fielded a second-string side, managed to beat Poland 1-0 in Klagenfurt, an Austrian victory was never on the cards as Germany dominated proceedings.
Germany miss chances as Austria press
Gomez sees the chance go begging
Austria gave Germany a few nervous moments, particularly in the first half. Germany should have been ahead early on when Mario Gomez missed a gilt-edged chance to silence the 51,000 home crowd after Miroslav Klose ran through the Austrian defense on the right of the area and crossed low, only for the Stuttgart striker to scoop the ball straight up with the goal at his mercy. The ball flew up high and Austrian defender Gyorgy Garics headed it back off the line.
It was the latest fluff from Gomez who has been lacking confidence in each of Germany's group games so far but has been preferred up front to Lukas Podolski who again operated from a left midfield role in Vienna.
Austria focused on hitting Germany on the break and the tactic almost paid off in the 19th minute when Erwin Hoffer was put through on goal, only for his control to let him down, giving Jens Lehmann the chance to gather.
Podolski again showed what Germany were missing up front when he ghosted in from the left and let fly from the edge of the area, forcing a good save from Juergen Macho at full stretch.
Sideline spat sees coaches sent to the stands
Both Loew and Hickersburger were sent to the stands
The drama wasn't only reserved for the pitch. Coaches Joachim Loew and Josef Hickersberger were caught up in the emotion midway through the first half and after an argument over refereeing decisions and the incursion by the Austrian trainer into the Germany technical area, both coaches were sent to the stands.
The new fiery side to Loew seemed to transfer to his players after the break and it took just four minutes after the restart before Germany were ahead. Ballack's free kick, belted right-footed into the top corner, gave macho no chance. The Germany captain, who had come in for a lot of criticism in the days after the Croatia defeat, reacted as only a man proving a point could.
Germany fail to capitalize but hang on for qualification
Austria fought hard but in vain to save their campaign
It should have been the start of a rout and Germany had chances in the following fifteen minutes to kill Austria off but the hosts weathered the storm and went about applying pressure on Germany for the rest of the match. The Germans had a couple of good chances at the end through substitute Oliver Neuville and Klose but in the end it was Ballack’s thunderbolt which saw Germany through.
Germany finish the group on six points, three behind Croatia, while Austria and Poland each have one point.
Germany will face Portugal in the quarter-finals, while Croatia take on Turkey.
Klasnic marks remarkable comeback
Croatia completed Group B with a 100-percent record after they beat Poland 1-0 in a disappointing match on Monday.
Klasnic scored the winner for Croatia in a woeful game
Ivan Klasnic scored the only goal of the game after 52 minutes and though Poland had a couple of late chances, Croatia were deserved winners as they moved through to a quarter-final against Turkey.
Klasnic, who was the first kidney transplant recipient to play a match at the European Championships, finished off neatly after some nice play by Danijel Pranjic.
Final Group B game a non-event
Having already wrapped up top spot in the group, Croatia manager Slaven Bilic made nine changes but while Poland needed victory to stand a chance of progressing, they were woeful.
Pranjic caused Poland all sorts of problems, getting behind the defence several times, and Poland didn't create anything of note in the first half but kept Croatia at bay.
But the deadlock was broken seven minutes into the second half when Pranjic again broke clear and Klasnic slotted the ball home.
Poland came into things as the match went on and Tomasz Zahorski should have scored late on only to dwell on the ball long enough for Croatia to clear the danger.