After a succesion of attacks and counter-attacks in the final kilometres, it was Geraint Thomas who took his second successive victory in the French Alps to strengthen his position in the race lead.
Thomas (Team Sky) accelerated in the final metres of the epic climb to beat Tom Dumoulin (Team Sunweb), Romain Bardet (AG2R La Mondiale), Chris Froome (Team Sky) and Mikel Landa (Movistar).
[tdf widget="stagewinners" stage="12"]
'Honestly, I'm speechless," Thomas said in the post-race interview. "I don't know what to say. There is not a chance in hell that I thought I was going to win today.
"I just followed Dumoulin, Bardet while Froome was attacking, and it was bad luck for Nibali, who I nearly rode over his back wheel and nearly came down myself.'
The top of the general classification remained unchanged with Thomas leading Sky team-mate and defending champion Froome by one minute 39 seconds and Dumoulin by another 11 seconds. Thomas was asked about the leadership situation after strengthening his hold on the yellow jersey.
"This race is so hard and you never know how the body reacts," said Thomas. "I'm still riding for Froome. He's still the man. He won it four times and is probably the best ... ever. I'm just going to enjoy this now."
[tdf widget="tourleaders" stage="12"]
Solo stage leader Steven Kruijswijk (Lotto-NL-Jumbo) lit up the stage after attacking from the early break. He started the day just over two and a half minutes down on Thomas, but his lead over the chasing peloton stretched out to six minutes to the Yellow Jersey group after the Dutchman attacked from the breakaway.
He led over the top of the Croix de la Fer and started climbing to Alpe d’Huez with an advantage of four minutes on a group of thirty riders chasing him.
For a moment it looked like Kruijswijk would take the victory after spending almost 70 kilometres at the front of the race but the grinding pace set by the chasers, particularly Team Sky's Egan Bernal, and successive late attacks by Vincenzo Nibali (Bahrain Merida), Nairo Quintana (Movistar), Bardet and Landa ended his chance with just four kilometres to go.
Bardet attacked again with 2.5km to go while Nibali was chasing back after colliding with a moto, and five riders were reunited at the front where Thomas proved to be the fastest inside the final kilometre.
The action immediately started on the Col de la Madeleine with the mountains classification battle between Julian Alaphilippe (Quick-Step Floors) and Warren Barguil (Fortuneo-Samsic) featuring, with the former outsprinting his rivals to extend his polka dot jersey advantage.
With 84 points, Alaphilippe leads Barguil (70) by 14 points while Serge Pauwels of Dimension Data follows on 63.