A perfectly-timed sprint from Arnaud Demare secured the French rider a win in stage 18 of the Tour de France. Further back, Briton Geraint Thomas tightened his grip on the yellow jersey.
Points classification leader Peter Sagan, who endured a difficult time on Wednesday, took charge with about 10km to go but as the Slovakian dropped back, Demare saw his chance and powered through to pip his compatriot Christophe Laporte by a whisker.
Demare was set up for the sprint finish by his Groupama team, who worked tirelessly in the final kilometres to make sure Sagan's chances were limited.
"I didn't battle all this time for nothing, I didn't give up in the mountains," said a relieved Demare, who had to fight through some challenging mountain stages to avoid missing the time cut.
The Frenchman added that comments from German rival Andre Greipel, who accused him of holding on to a car to make it through the mountains, spurred him on. "I was thinking about Greipel," Demare said.
Britain's Geraint Thomas, of Team Sky, finished close behind to retain the yellow jersey and move a step closer to the overall win three days before the 21st and final stage in Paris.
The Welshman holds a 1min 59sec lead on Dutch rival Tom Dumoulin (Sunweb) and four-time champion and teammate Chris Froome heading into Friday's 19th stage.