Gomez scored Stuttgart’s consolation goal as they lost 3-1 at home to Darmstadt on Sunday but the 2007 Bundesliga champions nonetheless secured an automatic promotion spot after finishing second behind Armenia Bielefeld.
Gomez was part of the Stuttgart side who were relegated from the German top flight last season but he stayed to help them bounce straight back up at the first time of asking before deciding to hang up his boots at the age of 34.
"It was my absolute goal to say goodbye here as a first division player,” Gomez told SID.
"I was sure at the beginning of the season that we will go up. So I decided that this will be my last year at Stuttgart, in Germany and probably as a football player.”
Gomez started his career at Stuttgart, helping the club to the Bundesliga title in 2007 before joining Bayern Munich in 2009.
He won a pair of Bundesliga titles in Bavaria and the 2013 UEFA Champions League before departing for further spells with Besiktas, Fiorentina and Wolfsburg.
Gomez returned to Stuttgart in January 2018 and his two spells at the club saw him score 80 goals in 180 league games.
Gomez earned 78 caps for the German national team, scoring 31 goals and represented his country at five major international tournaments, including two FIFA World Cups.