Thomas, who will lead Team Sky at the Giro alongside Mikel Landa, had a 13 second lead over Thibaut Pinot (FDJ) coming into the final stage, and had to fend off numerous attacks over the race’s last major climb, before finishing third behind Pinot and Brent Bookwalter (BMC Racing) on the flat finish in Trento.
The Welshman received significant help from Landa who sat on the front of the elite group of favourites for much of the final 50 kilometres, securing himself fifth overall in the process.
The profile of the final stage of the Tour of the Alps was dominated by the 19km climb of Monte Bondone, and this was where the real action kicked off as the general classification contenders tried to challenge Geraint Thomas’ grip on the leader’s jersey.
Michele Scarponi (Astana), who had led the race after winning the opening stage, was the first to put in an acceleration, before further moves from Pinot and Pierre Rolland (Cannondale-Drapac).
For a few moments Thomas found himself distanced, but hard work from team-mate Mikel Landa was enough to bring back the big-name escapees, creating a small group of around 12 riders at the front of the race.
The final attack over the top of the climb came from young Colombian Egan Bernal (Androni Giocattoli), who moved clear on a false flat approaching the mountains point to take a lead of around 15 seconds onto the descent towards the valley below.
On technical roads at the top of the descent Bernal was able to extend his lead towards 30 seconds, but as Landa led the chasers down the bigger roads near the valley floor he was eventually caught with 23km remaining.
With Bernal caught, the next attack came from team-mate Rodolfo Torres, who used the 10 per cent gradients of the small climb at Novaline to jump clear.
Another Colombian, Torres was able to open a 10-second gap as Landa steadfastly remained at the front of the chasing pack.
That gap remained steady until Domenico Pozzovivo attacked towards the top of the climb, with only Thomas and Pinot able to follow immediately, before Scarponi latched on.
The four rider group briefly held an advantage of 10 second lead, but were brought back by the rest of the general classification contenders to set up a group sprint in Trento.
Clearly confident from his second place finish on stage four, it was left to Pinot to lead the group through a technical final 500m, leading out the sprint and comfortably holding off Bookwalter for the stage win, while Thomas finished a close third to secure overall victory by seven seconds.
Tour of the Alps, stage five: Smarano to Trento (192.5km)
1. Thibaut Pinot (Fra) FDJ, in 5-13-01
2. Brent Bookwalter (USA) BMC Racing
3. Geraint Thomas (GBr) Team Sky
4. Domenico Pozzovivo (Ita) Ag2r La Mondiale, all at same time
5. Mikel Landa (Spa) Team Sky, at 2 secs
6. Michele Scarponi (Ita) Astana Pro Team
7. Emanuel Buchmann (Ger) Bora-Hansgrohe
8. Pierre Rolland (Fra) Cannondale-Drapac
9. Egan Bernal (Col) Androni Giocattoli
10. Sergio Pardilla (Esp) Caja Rural-Seguros RGA, all at same time
Final general classification
1. Geraint Thomas (GBr) Team Sky, in 20-49-37
2. Thibaut Pinot (Fra) FDJ, at 7 secs
3. Domenico Pozzovivo (Ita) Ag2r La Mondiale, at 20 secs
4. Michele Scarponi (Ita) Astana Pro Team, at 27 secs
5. Mikel Landa (Esp) Team Sky, at 42 secs
6. Pierre Rolland (Fra) Cannondale-Drapac, at 52 secs
7. Emanuel Buchmann (Ger) Bora-Hansgrohe, at 54 secs
8. Danilo Celano (Ita) Italy, at 54 secs
9. Egan Bernal (Col) Androni Giocattoli, at 1-02
10. Rodolfo Torres (Col) Androni Giocattoli, at 1-16