Germany booked their place in the semi-finals of Euro 2008 by seeing off a below-par Portugal side in Basel.
Bastian Schweinsteiger sidefooted in the first and his free-kick created the second for the head of Miroslav Klose.
Nuno Gomes finished from close range to give Portugal hope, but they failed to defend another Schweinsteiger free-kick and Michael Ballack headed their third.
Portugal substitute Helder Postiga pulled one back in the dying stages but
there was to be no grandstand finish.
Portugal had looked so impressive in qualifying for the knockout stages but Luiz Felipe Scolari's reign ended in disappointing fashion.
Scolari, who takes over as Chelsea boss next month, had suggested their lack of height might be exposed by a physically superior German side.
But it was a failure to defend set-pieces that proved their downfall.
In contrast, Germany gave an accomplished display despite suspended coach Joachim Low having to watch the game from the stands.
They will now face the winners of the Croatia-Turkey quarter-final in the last four and will be strong favourites to progress to the final on this showing.
The selection of Schweinsteiger from the start gave them a spark that was missing from their group games.
Germany's Michael Ballack on his decisive goal
He gave them the lead when he got ahead of Paulo Ferreira to burst into the box and steer home a cross from Lukas Podolski, after he had c****ined well with Ballack down the left channel.
Germany made it two goals in four minutes when Schweinsteiger's curling free-kick was perfect for Klose to head past Ricardo.
It was Cristiano Ronaldo who looked to be the guilty party in allowing Klose a free run at goal.
The Manchester United winger was unable to influence the game and the 2004 finalists' hopes were dealt a further blow when Joao Moutinho was forced off after half an hour.
It was from Ronaldo's shot that led to Gomes' strike, but it owed more to Deco's bursting run from the edge of his own box.
The Barcelona star released Simao and he found Ronaldo, who was denied by Jens Lehmann only for Gomes to show quickness of mind and feet to turn and fire past Christoph Metzelder's attempted clearance.
It was developing into a wonderfully open game, with both sides continuing the theme of the tournament by committing men forward and playing positive football.
Ballack and then Ronaldo went close just before the break and Pepe should have scored with a close-range header from a corner shortly after the interval.
The match looked headed for an intriguing final half hour, only for Portugal's defence to again go to sleep as Schweinsteiger swung in another pinpoint free-kick.
This time it was Ferreira who lost his man, although Ballack did appear to push his Chelsea team-mate before heading past a stranded Ricardo.
Portugal's momentum was stopped in its tracks and they found themselves restricted to long-range shots as Germany looked to close the game out.
Podolski was a yard away from adding to his three goals at the tournament with a hammer of a left-foot shot.
The game got the thrilling climax that it deserved when Nani crossed for fellow substitute Postiga to head in three minutes from the end.
But there was to be no fairytale ending to Scolari's impressive coaching career with the Portuguese.