The Groupama-FDJ rider surged clear of Slovakian Sagan and Australian Matthews to win the 143km seventh stage from Matera to Brindisi.
“The work my team did was amazing,” said Demare. “I waited and I launched my sprint at the right moment.”
After some earlier splits, the race came back together for the final 20km to set up a bunch sprint to the finish but no one able to find the room to challenge Demare, the French national champion.
“My team-mates have made the difference even more than the great confidence I have these days,” he added.
Peter Sagan, riding in his debut Giro, took a familiar second place – his third of the race – as he still seeks a first win in the Italian Grand Tour.
Geoghegan Hart remains the best-placed Briton in 19th place, three minutes and 18 seconds down, with Knox in 20th and Yates still 21st at three minutes and 52 seconds.
GET UP-TO-THE-MINUTE SPORTS NEWS COVERAGE, SCORES, HIGHLIGHTS AND COMMENTARY FOR NFL, MLB, NBA, COLLEGE FOOTBALL, EPL, NCAA BASKETBALL AND MORE. LIVE COVERAGE. HTTP://SPORTSLOUD.COM