Gomez, who started ahead of Miroslav Klose in attack, ended a turgid opening 74 minutes with a pinpoint header into the corner of the goal, outjumping Joao Pereira six yards out from Sami Khedira’s cross.
Portugal had hit the crossbar just before half time as defender Pepe’s close-range shot cannoned onto the line and away.
The game was a disappointing spectacle considering the talent on show, with much of the play getting bogged down in midfield as the Portuguese defended in numbers.
Gomez glanced an early header at goalkeeper Rui Patricio from a Jerome Boateng cross.
Arsenal’s new signing Lukas Podolski skidded a low first-time shot straight at the goalkeeper barely ten minutes in.
Cristiano Ronaldo skipped past Boateng down the left to slide a cross into the box, but Helder Postiga failed to make contact at the near post; Portugal’s first moment of danger.
The Germans had the ball in the net on 24 minutes, but French referee Stephane Lannoy decided to award a free kick against Portugal for a foul by Chelsea’s Raul Miereles on Real Madrid’s Sami Khedira in the buildup.
Podolski had plenty of time to line up a shot off a Mesut Ozil low ball from the left, but the Polish-born forward couldn’t keep it down.
Portugal proceeded to frustrate the Germans by defending in numbers, crowding out the midfield to ensure attacks came to nothing.
A fierce cross from Ozil was intercepted by Bruno Alves before the Germans missed a good double chance.
The ball fell to Podolski unmarked at the back post, he chose to volley it back across goal rather than shoot and Tomas Muller side-footed wide.
Portugal nearly took the lead against the run of play as Real Madrid defender Pepe struck the crossbar after a corner fell to him eight yards out. The ball crashed down onto the line but didn’t cross it.
The second half saw the pace pick up intially, as a chipped cross from Nani was athletically headed clear by Borussia Dortmund centerback Mats Hummels.
Mario Gomes directed a header over on 57 minutes after the Portuguese gave the ball away cheaply.
The Germans then lost the ball too easily themselves, allowed Nani burst through the center and release Ronaldo on the edge of the box, but Boateng got across quickly to charge down his left-footed shot.
Gomez headed home with Klose waiting on the touchline to replace him, prompting coach Joachim Low to send the Lazio striker back to the bench.
Ronaldo hit a trandmark dipping shot on 81 minutes that Manuel Neuer awkwardly palmed away.
Ronaldo then turned provider, poking to Real Madrid teammate Fabio Coentrao on the edge of the box only for Hummels to get a vital diving block in.
Portugal squandered the chance of the match with three minutes left. Substitute Nelson Oliveira set up fellow replacement Silvestre Valera, but the latter blasted straight at Neuer from point-blank range.
Holger Badstuber blocked a last-minute shot from Nani, and Bruno Alves headed over from the resulting corner.
The win takes the Germans joint top of the group after Denmark’s surprise 1-0 win over the Netherlands earlier Saturday.
Germany face the Netherlands next on Wednesday, with Denmark playing Portugal.
Germany: Manuel Neuer, Mats Hummels, Holger Badstuber, Phillipp Lahm, Jerome Boateng, Sami Khedira, Bastian Schweinsteiger, Mesut Ozil (Toni Kroos, 87), Thomas Muller (Lars Bengder, 90), Lukas Podolski, Mario Gomez (Miroslav Klose, 79).
Portugal: Rui Patricio, Bruno Alves, Pepe, Fabio Coentrao, Miguel Veloso, Joao Periera, Joao Moutinho, Raul Miereles (Silvestre Varela, 79), Nani, Cristiano Ronaldo, Helder Postiga (Nelson Oliveira, 69).
- 28/08/2015 Europa League group stage draw defines rivals of Garabagh and Gabala
- 28/08/2015 Messi, Sasic voted UEFA's best players of 2014-2015
- 28/08/2015 Tale Heydarov: "This is a great achievement, a great victory"
- 28/08/2015 Gabala FC qualifies for Europa League group stage
- 27/08/2015 Azerbaijan`s Qarabag FC qualifies for Europa League group stage
- 21/08/2015 Azerbaijan’s Karabakh FC wins Switzerland’s BSC Young Boys FC 1:0
- 12/08/2015 Barcelona win UEFA Super Cup with Pedro's winner in extra time
- 07/08/2015 Georgian law enforcement agencies investigate incident in match with "Gabala"
- 07/08/2015 Tale Heydarov: "Our aim is to overcome the “playoff” round and enter to the group stage"
- 06/08/2015 Gabala FC qualifies to play-off round of the Europa League qualification
- 04/08/2015 UEFA punishes "Dinamo" Tbilisi for behavior of fans at match with "Gabala"
- 01/08/2015 “Gabala” makes a statement on the scandal in the match against "Apollo"in Cyprus
- 25/07/2015 2018 FIFA World Cup Preliminary Draw kicks off
- 25/07/2015 Tractor Sazi Tabriz FC congratulates Gabala FC - PHOTO
- 21/07/2015 FIFA vote to be held Feb 26; Blatter defies calls to go now
- 19/07/2015 Bartomeu elected for 2nd term as Barcelona president
- 10/07/2015 Gabala Vice-President: We are against such cases in the game and don’t welcome it - UPDATED
- 10/07/2015 FC Inter Baku progress to 2nd qualifying round of Europa League
- 10/07/2015 Tale Heydarov: "We achieve our goal"
- 09/07/2015 Azerbaijani fans display banners at “Gabala” - “Dynamo” match - UPDATED - PHOTO
- 09/07/2015 “Gabala” FC (Azerbaijan) defeats “Dynamo” (Georgia): 2-0 - PHOTO
- 06/07/2015 Nani signs for Fenerbahce
- 05/07/2015 Chile win 4-1 on penalties in the Copa America
- 04/07/2015 Galatasaray signs Arsenal's Lukas Podolski
- 22/06/2015 Maradona to run for FIFA presidency
- 16/06/2015 Azerbaijan, Armenia not to face in 2018 FIFA World Cup qualifying round
- 12/06/2015 FIFA executive committee to convene for extraordinary meeting on July 20
- 07/06/2015 Barcelona defeats Juventus in UEFA Champions League final
- 03/06/2015 Sepp Blatter decision unrelated to corruption allegations - daughter Corinne Blatter
- 02/06/2015 FIFA secretary general embroiled in $10 million 'bribe'
- 02/06/2015 Russian sports minister comments on Blatter's intention to resign
- 02/06/2015 FIFA president Joseph Blatter to announce resignation
- 30/05/2015 Former FIFA VP Warner released
- 29/05/2015 Sepp Blatter reelected FIFA president amid scandal
- 28/05/2015 Putin: FIFA-linked arrests are US attempt to thwart Blatter re-election
- 28/05/2015 Fifa crisis: Uefa wants presidential election postponed
- 28/05/2015 Sevilla wins Europa League, beating Dnipro 3-2 as Carlos Bacca scores twice
- 27/05/2015 Switzerland launches investigation into award of 2018, 2022 world cups to Russia, Qatar
- 27/05/2015 9 FIFA officials arrested in Switzerland
- 27/05/2015 Two FIFA vice-presidents arrested over corruption charges