Frenchman Warren Barguil won his second stage of the Tour de France on the imposing Col d'Izoard on Thursday as compatriot Romain Bardet snatched back four seconds from overall leader Chris Froome.
Bardet finished third on the day to take some bonus seconds that lifted him above Rigoberto Uran into second overall and closed the gap to Froome to 23sec.
Colombian Darwin Atapuma finished second, 20sec behind Barguil with Bardet winning the sprint for third against Froome and Uran.
But with only Saturday's time-trial left in which to make a significant difference to the standings, reigning champion Froome looks set to claim a fourth Tour de France title.
"I'm happy to have passed the Alps without problems this year," said Froome, 32.
"The Alps are always the toughest for me. Now I'm looking forward to the time-trial in Marseille and we'll see."
It was a thrilling battle on the final hors category climb at the end of the 179.5km Alpine 18th stage from Briancon to the Col d'Izoard.
Atapuma was part of an original 54-man breakaway that splintered over the two huge climbs of the day.
He reeled in Kazakh Alexey Lutsenko halfway up the Izoard climb while the peloton led by Bardet's AG2R team, at one point eight minutes back, started to close in.
Barguil made his move with 6km to go but still had two minutes to make up on Atapuma, catching him with 1.4km left and leaving him behind inside the final kilometre to win the first ever stage finish on the Izoard.
"I'm just living in my dream at the moment, it's just crazy," said Barguil, who also won the 13th stage on Bastille Day, the French national holiday.
"After a lot of bad luck I've shown finally my real potential to everybody."
- 'In the clouds' -
Barguil, who had already sewn up the king of the mountains polkadot jersey earlier in the day, leapt above two-time former winner Alberto Contador into ninth overall.
"I'm still in the clouds, I've left the earth," said Barguil.
"It's an exceptional day, I never imagined I could win on the Izoard."
Behind that, Bardet launched an attack 3km from the finish but Froome and Colombian Uran stuck to him like glue.
Briton Froome attacked next but couldn't stay clear and once they hit the final kilometre it was a battle of wills to the line at a vertiginous 2,360-metres above sea level.
"I tried to distance Rigoberto Uran and Romain Bardet but it was almost impossible today," added Froome.
Uran gave up two seconds and dropped to 29sec off Froome, but is widely regarded a better time-trialist than Bardet.
"I thought I was going to suffocate on the line," said Bardet.
"I gave absolutely everything."
Italian Fabio Aru was struggling over the final 6km and having started the day in fourth at 53sec, dropped below Froome's Spanish team-mate Mikel Landa (1min 36sec) to fifth at 1:55.
Behind that there was not change for Ireland's Dan Martin in sixth, Briton Simon Yates in seventh, and leader of the young rider's white jersey competition, and Louis Meintjes of South Africa in eighth.