Chris Froome conceded four seconds to Romain Bardet on the Col d'Izoard but took another step towards his fourth Tour de France title as Warren Barguil won stage 18.
Froome was alongside Bardet on the finish line but it was the Frenchman who finished third behind Barguil and Darwin Atapuma to collect four bonus seconds and trim his deficit in second place to 23 seconds.
Colombian Rigoberto Uran, who began the day level with Bardet on the general classification, was a further two seconds back on the road, and now trails Froome by 29 overall.
Irishman Dan Martin was active in forcing the pace on the Izoard, and finished within 19 seconds of Bardet and Froome to retain sixth place overall.
Though Froome has seen his advantage cut slightly, the main goal was to retain yellow on the final summit finish of this year's Tour.
The Team Sky rider must now defend it over relatively flat territory on Friday's stage to Salon-de-Provence before Saturday's time trial in Marseille where he is expected to gain time.
For Barguil the stage victory - his second of this year's Tour - underlined his superiority in the king of the mountains classification, which he has mathematically wrapped up, needing only to safely make it to Paris.
But others suffered on the climb. Italian national champion Fabio Aru was dropped again, conceding over a minute as the former yellow jersey in this race slipped to fifth on general classification, behind Froome's team-mate Mikel Landa and almost two minutes adrift of the race lead.
Simon Yates conceded another 25 seconds to South African rival Louis Meintjes in the young riders' classification but the Orica-Scott man still holds the white jersey by a margin of two minutes and six seconds.
The 179.5km stage from Briancon saw a 54-man breakaway go up the road early on but did not come to life until the imposing climb of the Col d'Izoard, 14.1km long at an average gradient of 7.3 per cent, as it took the peloton to a height of 2,360m.
Aru's Astana team-mate Alexey Lutsenko had a lead of more than four minutes over the yellow jersey group as he started the climb solo - having attacked the fracturing breakaway - but the race was about to be blown to pieces.
Team Sunweb's Barguil attacked alongside Spanish veteran Alberto Contador around six kilometres from the top and swiftly distanced the main contenders, who stayed focused on each other.
Sky tried to tease Bardet (AG2R La Mondiale) and Uran (Cannondale-Drapac) into making a move as they sent Landa up the road shortly after.
Bardet took the bait with three kilometres to go but Froome followed him and briefly dropped him on the short descent at Casse Deserte, two kilometres from the top.
For a moment it appeared the race was over as he swiftly gapped the others, but the distances were deceptive and instead the decisive move came when Bardet attacked with 400 metres left
That was enough to get Bardet - runner up to Froome 12 months ago - four extra seconds and solo ownership of second place.
"It would have been nice to take a bit of time today but all in all I'm happy with that," Froome said at the end of the stage.
"The team was fantastic in the final (part) it was great having the numbers there to be able to control things and having that card to play with Mikel Landa. I tried to to give it a bit of a dig behind, I thought I had a gap, but Rigoberto Uran brought it back.
"They have both ridden a very impressive race up to now. Romain Bardet taking the bonus seconds today, he can be pretty happy with that. I think it's all still to race for now in the final time trial to Marseille."