After a breakaway had been dragged back and the expected sprint denouement ensued, Demare edged out the in-form Peter Sagan and Alvaro Hodeg at the end of the mostly flat 182-kilometre leg from Porto Sant'Elpidio to Rimini along the Adriatic coast.
Demare, in inspirational form for the Groupama-FDJ team, also won the fourth, sixth and seventh stages, which also ended in mass sprints.
All the GC contenders finished safely with Joao Almeida (Deceuninck-Quickstep) retaining his 34-second lead over Wilco Kelderman (Sunweb) and Pello Bilbao (Bahrain McLaren) still third at 43 seconds.
Australia's Team Sunweb rider Jai Hindley, who has enjoyed an excellent tour, maintained his seventh position overall, still only 1:19 down on the leader Almeida.
After the Mitchelton-Scott and Jumbo-Visma teams left the race on Tuesday following positive COVID-19 tests, the 182km ride along Italy's largely flat Adriatic coast was uneventful apart from an incident in which Olympic track champion Elia Viviani was clipped by an official motorbike 30km from the end.
Italian Viviani appeared relatively unharmed and continued but had to work hard to get back into the group and did not feature in the final sprint as Demare again showed his class.
It had looked for a while as though Belgium's Sander Armee might hang on for a victory after he and Mattea Bais, part of an initial six-man breakaway, attacked with just over 30km remaining and built a two-minute lead as the main group was slow to organise itself to chase them down.
With 10km remaining Armee (Lotto-Soudal) still had a minute on the peloton but he was quickly swallowed up on the flat and fast run-in to the Italian seaside town.
After Armee was caught with 6km remaining the UAE Team Emirates riders took up the pace in the twisty final kilometres and Fernando Gaviria was the first to attack but Demare powered through to claim victory.
"Impressive, really impressive," Demare said. "The whole team moved up for me. They had to bring the breakaway back and set a really high pace.
"It feels amazing. Of course, I didn't think I could get four stages here. I was looking for a stage win and I'm so happy. I really want to congratulate the whole team because it's their victory as well. They believed in me."
Demare still leads Sagan in the points classification.
Thursday's 204km stage starts and finishes in Cesenatico and features a succession of tough climbs.