Michael Ballack struck a thunderbolt free kick to send Germany through to the Euro 2008 quarter-finals with a 1-0 win over co-hosts Austria.
Germany, needing to avoid defeat to stay in the tournament, looked nervous in the first half but Ballack's strike from 25 metres at the start of the second changed the game and took them through as Group B runners-up behind Croatia.
They will go on to face Group A winners Portugal in Basel on Thursday.
Austria, needing a win to stand a chance of going through, gave Germany a few nervous moments, particularly in a first half that ended with the two coaches sent to the stands by the referee after an argument between the two of them at pitchside.
Germany should have given themselves the perfect start, and silenced the majority of the 51,000 home crowd, when Miroslav Klose ran through the Austrian defence on the right of the area and crossed low for Mario Gomez.
The German forward was just a metre out with an open goal but he mishit his shot, the ball flew up high and Gyorgy Garics headed it back off the line.
Austria's game plan 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.
Germany's only other good first-half chance came when Lukas Podolski let fly from the edge of the area and forced a good save from Juergen Macho, at full stretch low to his left.
Ballack's free kick, belted right-footed into the top corner, should have given Germany the chance to pick off Austria on the break but they remained cautious.
Austria, however, were short of ideas themselves and well before the end they were reduced to taking pot shots mainly from outside the area.