BASEL, Switzerland (CNN) -- Michael Ballack sent his new Chelsea manager packing from the European Championship finals as Germany clinched a semifinal berth with a dramatic 3-2 win over Portugal in Basel.
Ballack celebrates the goal that sent Germany into the semifinals of the European Championship.
Germany skipper Ballack headed the decisive third goal after 61 minutes to end Ronaldo-inspired Portugal's interest in a tournament they had threatened to take by storm.
Portugal coach Luiz Felipe Scolari very much hoped to delay his departure for Stamford Bridge but the signs were not good when midfielder Bastian Schweinsteiger opened the scoring midway through the first half.
Schweinsteiger, who hit two goals in Germany's 2006 World Cup third-placed play-off success over the Portuguese, struck after 22 minutes -- and Miroslav Klose added a second four minutes later.
Striker Nino Gomes pulled one back -- to make him only the third player in the history of the competition to score in three different finals -- after 40 minutes to offer Scolari the springboard for a second half revival.
But Germany, with coach Joachim Loew watching from the stands because of a UEFA ban imposed after his 'sending off' against Austria, had other ideas.
Scolari had pinpointed Ballack as 'a highlight of the tournament' and the inspirational Chelsea midfielder did not disappoint.
Germany, however, had to endure a nail-biting finale after Helder Postiga pulled one back for Portugal after 87 minutes.
In the end three-times champions Germany took their place in the last four against Croatia or Turkey.
"Sitting behind the window in the stands was really difficult," said 48-year-old Loew. "I was a long way from the pitch. Obviously from on high you see things better but it is too far from the action.
"Against Austria and Croatia, we did not play well. That is why today we tried to send a signal. We wanted to shut down the spaces, and to go from defense to attack really quickly, which we managed to do."
For Scolari there was nothing but disappointment. "I am naturally disappointed and frustrated," said the Brazilian.
"I failed and I wasn't able to achieve the target that the federation had set me, qualifying for the semi-finals. Germany were simply the best team at the most important moments."
Loew's team, under the temporary guidance of his assistant Hans-Dieter Flick, controlled the tempo and possession in the early stages.
Thomas Hitzlsperger had the first shot with a ninth-minute free-kick, blocked by Deco, and the Stuttgart midfielder lashed another left-footed effort goalwards moments later which rippled Ricardo's side-netting.
Simao made Jens Lehmann work for the first time when he found himself well placed on the right-hand side of the area following good build-up play from Pepe and Deco, but the former Arsenal stopper was equal to the Atletico Madrid winger's effort.
Gomes then looked to put Cristiano Ronaldo through but Arne Friedrich got across swiftly at the expense of a corner.
Jose Bosingwa fired in a cross from the left towards Joao Moutinho but it arrived at an awkward height for the Sporting Lisbon midfielder, who diverted the ball over the bar with his thigh.
That miss proved costly as shortly afterwards the Germans forged ahead.
Lukas Podolski, who had been doubtful with a calf injury, burst down the left and sent in a low cross which Schweinsteiger tapped home at the near post.
Germany struck again soon after when man of the match Schweinsteiger floated in a free-kick and Ronaldo remained flat-footed while Klose sped by to force the ball beyond Ricardo.
Portugal suffered a further blow when Moutinho hobbled off with a knee injury to be replaced by Raul Meireles, but they showed more promise just before halftime.
And Gomes picked the perfect time to claim his first goal of the tournament to halve the deficit. He reacted first to fire into the bottom-left corner via the right boot of Christoph Metzelder after Lehmann had parried a Ronaldo drive.
Germany almost immediately restored their two-goal cushion when Ballack cut in well from the left onto his right foot, but Ricardo got down well at his near post to save.
Ronaldo had an opportunity to level in first-half stoppage time, only to see his effort drift just wide of the keeper's right-hand upright.
Friedrich and Philipp Lahm were shown yellow cards in the opening minutes of the second half for lunges on Ronaldo and Simao respectively.
Pepe passed up a great chance to restore parity for Portugal when he headed over in the 57th minute after Deco had flicked on a corner.
Once again, the Portuguese were made to pay when Ballack met Schweinsteiger's free-kick from the left and made space by shoving Chelsea colleague Paulo Ferreira to head past Ricardo.
Scolari criticized referee Peter Frojdfeldt for allowing Ballack's goal. "We made some mistakes in the first two goals, but I can contest the third and television can show it clearly," he said.
Scolari threw attackers Nani and Postiga into the fray in a bid to rescue the match, but Podolski almost made it when his fierce long-range drive whizzed just past the right-hand post.
Nani then set up fellow substitute Postiga to head home a second and give Portugal hope. But there was to be no grand finale for Portugal and Scolari, as Germany - even without their coach on the touchline - held on.