The Welshman won in an uphill sprint from Team Sunweb’s Tom Dumoulin and AG2R La Mondiale’s Romain Bardet at the end of the 175.5km stage from Bourg-Saint-Maurice.
Thomas’s Sky team-mate Chris Froome was just behind in fourth with Movistar’s Mikel Landa fifth.
The quintet had attacked and counter-attacked one another on the way up one of cycling’s most famous climbs but were back together in the final few hundred metres, before Thomas accelerated out of the last bend to take the stage win for the second straight day.
“Not even in my wildest dreams did I think I would win on here,” Thomas said.
“It’s one of those things that will stay with me for the rest of my life.”
Thomas won by just a couple of seconds from Dumoulin, with Bardet one second behind him and Froome a further second back.
With bonus seconds applied, Thomas extends his lead in yellow over Froome by 14 seconds to one minute and 39 seconds, with Dutchman Dumoulin a further 11 seconds back.
It was a second Tour mountain stage win in a row for Thomas following victory in La Rosiere, and his third career Tour stage win.
His lead over Froome may have grown, but Thomas once again repeated that the four-time winner is Sky’s leader here.
“Like I said yesterday, I’m still riding for Froomey,” Thomas said. “Froomey is still the man. He knows how to ride for three weeks. Legend gets used way too much but he’s probably the best ever so I’m just going to enjoy this.”