After struggling and surviving in the mountains, the pressure was on the French rider to win a stage at the Tour and as one of the remaining high-quality sprinters left in the field, Démare lifted and did not disappoint in Pau.
The Groupama-FDJ rider finished ahead of Christophe Laporte (Cofidis) and Alexander Kristoff (Katusha-Alpecin) at the end of the 171km stage from Trie-sur-Baïse.
"I've been through some difficult moments but I really wanted to make it to the final sprints and play my cards," said Demare. "I always believed in myself and my chances of winning in this Tour."
"Winning today, before the final chance on the Champs Elysees is great for my motivation. This is for my wife, my family and my friends. People who know me, know how hard I trained for the Tour de France and this goal. That's why I'm so happy today."
Outside of a minor crash catching out Nairo Quintana (Movistar) and Adam Yates (Mitchelton-Scott), the general classification contenders had a quiet stage with no changes in the order below race leader Geraint Thomas (Sky).
The stage settled into a set pattern early with a five-rider break containing Mitchelton-Scott duo Matthew Hayman and Luke Durbridge, Guillaume van Keirsbulck (Wanty-Group Gobert), Niki Terpstra (Quick-Step Floors) and Thomas Boudat (Direct Energie).
There was some reward for the break with Terpstra claiming the first KOM at the Côte de Madiran while van Keirsbulck won the intermediate sprint and second KOM at the Côte d'Anos. Durbridge did enough work to drive the break to be awarded the prize as the most combative rider on the stage.
The sprinter's teams, largely led by Groupama-FDJ and later Peter Sagan's BORA-hansgrohe), kept the time gap under control and it never went beyond two minutes and 21 seconds with the catch coming with 16.5km to go.
The last kilometre came down to a mass sprint with every rider for himself. Démare hit the front in the final 100 metres before weaving across the road to hold off the challenge of Laporte to claim victory.