Uzbekistan 2-1 Spain: Gomez rectifies penalty miss to get La Roja up and running at Paris Olympics
La Roja took the lead through Marc Pubill, only for Uzbekistan captain Eldor Shomurodov to level from the spot before the break.
Gomez would see his own spot-kick attempt saved, but dusted himself down to net the decisive goal for Santi Denia's side.
A teasing free-kick delivery from the left-hand side was flicked on at the near post by Abel Ruiz, with Pubill providing the telling touch to give Spain the lead in the 28th minute.
However, Timur Kapadze's side drew level in the third minute of injury time when a VAR review saw Pau Cubarsi penalised for a pull inside the box, with Shomurodov firing beyond Arnau Tenas.
Spain were rewarded for a bright start to the second half when Aimar Oroz was tripped by Abbosbek Fayzullaev.
Gomez assumed responsibility but saw his effort brilliantly saved. However, he atoned for his error three minutes later as he swept home from Juan Miranda's inviting cutback.
Uzbekistan had the opportunity to snatch a first point at the Olympics late on, only for Umarali Rahmonaliyev to slice his shot wide in the sixth minute of injury time.
Data Debrief: A mixed bag for La Roja
Former Manchester City defender Gomez was the standout for Spain, registering more shots (three), more shots on target (three) than anyone on the pitch, finishing the encounter with an xG of 1.01.
Barcelona youngster Cubarsi endured a difficult afternoon having given away a penalty, but was strong in possession, completing 54 of his 57 passes (94.7%).
Despite registering six shots on target from the eight they attempted, Spain underperformed their expected goals (xG) by 0.60, something that will need to improve should they want to win a second gold medal.