Mario Gomez scored a magnificent header as Germany battled its way past Portugal to make a winning start to its EURO 2012 campaign.
Portugal's defensive obduracy had frustrated Germany for 72 minutes and Gomez was about to be substituted when he planted Sami Khedira's cross past goalkeeper Rui Patricio.
Suddenly faced with chasing the game, instead of settling for the bore draw, Portugal brought Cristiano Ronaldo and Nani into the game and laid siege on the German goal.
In a barnstorming finish, Germany goalkeeper Manuel Neuer brilliantly denied Silvestre Varela to seal the victory as Joachim Low's men made a successful start to their quest for a first European crown since 1996.
Germany featured seven Bayern Munich players, all of whom will have felt a daunting sense of deja vu in the first half as Portugal set itself to soak up the pressure.
Chelsea beat Bayern in the UEFA Champions League final a matter of weeks ago using exactly the same, backs-to-the-wall style that some would describe as anti-football.
Although Portugal started with Ronaldo, who has scored 112 goals in 101 appearances for Real Madrid, and Nani it set itself up to nullify Germany and play for the draw.
Mesut Ozil was the Germany's main attacking threat and the three-times European champion came close to an early goal with a header from Gomez.
Helder Postiga won a corner after a run from Fabio Coentrao but Portugal was sitting so deep it lacked any real fluidity in attack. Ronaldo was a spectator for most of the first half.
Thomas Muller picked out Arsenal-bound Lucas Podolski, who tried a low first time shot with the outside of his right foot that was easily saved.
Pereira did well to close down Ozil, who had jinked his way into the Portugal box after being released by his Real Madrid team-mate.
Postiga became the first player booked after he chased an underhit backpass from Mats Hummels and caught Neuer as he slid for the ball.
Neuer made an unsavoury meal of a fairly innocuous incident, simply to ensure the former Tottenham Hotspur striker was shown the yellow card.
When Ronaldo finally got a chance to run at Germany his trickery got the better of Jerome Boateng and his dangerous cross was stabbed behind for a corner.
When the cross came back in, Bruno Alves was unmarked in the box but he could not make contact with the ball and Germany escaped.
Khedira linked with Ozil to pick open the Portuguese defence with a neat one-two before he was fouled by Raul Meireles but the free-kick was drilled straight into the wall.
After 44 minutes of Germany dominance it was Portugal which created the best chance of the first half.
Defender Pepe made space in the box with a delightful first touch and then curled a fine shot over Holger Badstuber and on to the underside of the bar.
The ball crashed down onto the line and away. It was a close escape for Germany.
Meireles made two important blocks after the restart but Portugal did offer more in attack in the second half, with Nani beating Philipp Lahm before whipping in a cross.
The ball fell to Ronaldo in the box after a driving run from Coentrao but he was denied by Boateng's perfectly-timed block.
With Germany unable to break the deadlock, Low was just about to take off Gomez when the Bayern Munich striker scored with a brilliant header.
Gomez rose to meet Khedira's cross from the right and directed his downward header back across goal and inside the far post.
Low reacted by instructing Miroslav Klose to sit back down and Gomez almost had a second as he galloped unmarked into the box but Muller's cross was just ahead of him.
Portugal had to up its attacking game and threatened more in the final 10 minutes than it had in the previous 80.
Coentrao had an effort that was deflected just over the bar before Nani's cross dipped on to the bar and away.
Nelson Oliveira pulled the ball back for Varela inside the Germany box but Neuer was off his line in a flash and blocked the shot.
Ronaldo then picked out Nani but the Manchester United forward saw his shot deflect behind off Badstuber as Germany hung on.
Dateline will broadcast a special report looking at issues of safety that may confront visitors to the tournament. BBC reporter Chris Rogers spent a month on the terraces in host nations Poland and Ukraine, investigating pockets of hooliganism and looking at what steps UEFA has taken to give the host countries every opportunity, through EURO 2012, to clean up the game locally for good. See this special investigation on Dateline this Tuesday at 9.30pm on SBS ONE.