Gomez finished four seconds behind compatriot Mario Mola in the concluding race of the 10-event World Series, but that was good enough to give him the world title with 4,930 points — to the 4,795 amassed by Mola.
“I can’t understand it yet, I sometimes can't comprehend doing something like that in the last few years,” Gomez said of collecting his fifth world title. “It is just amazing.”
Gomez won his first world title in 2008, when it was decided by a single race.
Since the World Triathlon Series points system was created, only three men have been crowned champion – Gomez four times (2010, 2013, 2014 and 2015), Britain's 2012 Olympic gold medallist Alistair Brownlee in 2009 and 2011 and Brownlee's brother Jonathan in 2012.
Gomez and Mola duelled through the closing 10km run, with Mola kicking into overdrive the last 100 metres to grab the win.
South Africa's Richard Murray trailed much of the race, but pulled himself into third.
France's Vincent Luis finished fifth — enough to capture third place in the World Championship rankings.
Gomez, who won a triathlon Olympic test event at Rio de Janeiro in August, underscored his status as heavy favourite for Olympic gold next year in Rio — where he'll be trying to improve on the silver he won in London in 2012.
But he'll no doubt face stiff opposition from the returning Brownlee brothers, 2012 gold medallist Alistair and London Games bronze medallist Jonathan, who have been hindered by injury this year.