The Frenchman completed the 171km stage in 3:46:50, beating Cofidis, Solutions Credits’ Christophe Laporte and UAE Team Emirates’ Alexander Kristoff in the final sprint.
Dimension Data’s Edvald Boasson Hagen was in the mix, finishing fourth.
The stage had almost no bearing on the general classification as Team Sky’s Geraint Thomas retained his race lead, almost two minutes clear of Team Sunweb’s Tom Dumoulin.
Niki Terpstra, Guillaume Van Keirsbulck, Mathew Hayman, Luke Durbridge and Thomas Boudat attacked several kilometres into the race and created a gap.
The peloton chased hard over the next few kilometres, closing the gap, before the five got away again and increased their lead to one minute and 20 seconds approximately 30km into the race.
The gap fluctuated slightly before the five riders pulled away again, establishing a two-minutes-10-seconds lead just past the halfway mark.
Another 16km on and their lead had dropped to one-and-a-half minutes or about 1.1km.
With 54km remaining the gap dropped again to a minute and 20 seconds, as they approached a 19km climb.
Over the next 20km the peloton upped the pace, reducing the gap to 57 seconds. With 21km left, the gap was down to 29 seconds as the breakaway’s lead became precarious.
The breakaway was eventually caught with 18km left, as Simon Clarke surged ahead and was followed by a small group.
A few twists and turns and a roundabout later, the field stretched out and the peloton amalgamated with 16km to go.
Groupama FDJ and Bora-Hansgrohe controlled the head of the peloton in the final several kilometres.
Executing a fine lead-out following two sharp left turns in the last kilometre, Démare timed his attack well in the last 500m to win in the final dash.
World champion Peter Sagan was boxed in, preventing him from getting into any threatening space and as a result he finished eighth.
“This is what I was thinking about during the hard moments in the mountains,” Démare said afterwards. “My team was super and this was a nice reward for us.
“I can thank him because I thought of him a lot today,” he said of Andre Greipel after he insinuated the Frenchman held onto cars in order to make the cut-off time in yesterday’s stage.
“It’s not my philosophy of cycling to do that. I worked hard before the Tour to prepare for the mountains. It wasn’t easy to get through them and I’m very pleased to win today.