The Bayern Munich striker made a surprise start Saturday against Portugal at the European Championship and knocked in a deflected cross from Sami Khedira in the 72nd minute to give the Germans a 1-0 victory in Group B.
Gomez, who had created little before the goal, was due to be replaced by Miroslav Klose, who was already waiting on the touchline on his 34th birthday. And Gomez nearly scored another goal before Klose finally came on in 80th.
"I have two successful seasons behind me but it was a hard road for me," Gomez said about usually being second choice to Klose. "I am very happy that the coach had confidence in me and with the goal I could pay something back.
"The ball was deflected and landed exactly on the front of my head. It wasn't that difficult."
Despite indicating before the match that he would start the veteran Klose as striker, Germany coach Joachim Loew went with Gomez.
"Clearly, Miroslav was going to come in at that moment, but Mario scored the goal then," Loew said. "We waited a few more minutes."
Gomez was the Bundesliga's top scorer over the past two seasons and had 12 goals in the Champions League this season to help Bayern Munich reach the final, where it lost to Chelsea on penalties.
Germany was the better team Saturday but found it hard to break down a defensive Portugal. The Germans, seeking their first title since 1996, are considered one of the favourites of the tournament despite being in the toughest group along with the Netherlands and Denmark.
"They scored when we were improving a lot," Portugal coach Paulo Bento said. "We fought back and created some good chances. Success in football requires you to take your chances and we didn't do that."
Although Cristiano Ronaldo did little until late in the match, Portugal had a chance to equalize in the 84th when Nani hit the crossbar with a misdirected cross — the second time the team struck the frame in the match. And Silvestre Varela had another opportunity in the 89th but he shot straight at Germany goalkeeper Manuel Neuer from close range.
"Everyone knows the class of Ronaldo. You can't shut him down completely but we did well as a team. I think he had no more than two or three shots at goal," said Germany defender Jerome Boateng, who had been denounced by Loew after newspaper stories about his private life surfaced. "The criticism from the coach helped me and the whole team stood behind me."
Although Germany monopolized possession and chances, Pepe had the best opportunity of the first half, hitting the underside of the German crossbar late in the period after a Portugal corner. The ball hit the line and bounced out.
"We played very well tactically. We stayed in the match and we won 1-0, that's the most important thing," Loew said. "You don't want to fall behind in the first game. The first game is very important, it tells you where the team is, in which direction you are going."
Germany: Manuel Neuer; Jerome Boateng, Mats Hummels, Holger Badstuber, Philipp Lahm, Sami Khedira, Bastian Schweinsteiger, Thomas Mueller (Lars Bender, 90), Mesut Oezil (Toni Kroos, 87), Lukas Podolski, Mario Gomez (Miroslav Klose, 80).
Portugal: Rui Patricio; Joao Pereira, Bruno Alves, Pepe, Fabio Coentrao; Joao Moutinho, Miguel Veloso, Raul Meireles (Silvestre Varela, 80); Cristiano Ronaldo, Helder Postiga (Nelson Oliveira, 70), Nani.