The Quick-Step rider won the stage in 4:25:01. Peter Sagan, of Bora-Hansgrohe, was second, ahead of Lotto-Soudal’s Andre Greipel.
Overall leader Greg van Avermaet, of BMC, retained the yellow jersey.
The only classified climb on the flat route was the category 4 Cote de Saint-Jean-la-Poterie (800m at 7.8%) at 135km.
For most of the day, Dimitri Claeys and his Cofidis teammate Anthony Perez, Direct Energie’s Jerome Cousin and Guillaume van Keirsbulck, of Wanty-Groupe Gobert, formed the break.
With 70km remaining, the leading group enjoyed a two-minute gap ahead of the peloton, which was controlled by LottoNL-Jumbo, Lotto Soudall and Quick-Step.
The quartet hit the classified climb with a lead of 1 min 40 sec. Perez was first over the top and the gap shrunk to 1:22.
Ten kilometres from the bonus sprint the peloton slowed down, resulting in a crash. Jakob Fuglsang, of Astana, and Fortuneo-Samsic’s Kevin Ledanois went down and Tony Gallopin of AG2R La Mondiale’ suffered a puncture.
With 47km left, the gap between the peloton and the leaders was 2 min 5 sec.
Claeys was first to reach the bonus sprint in Limerzal, with Van Keirsbulck and Perez just behind him.
Tim Declerq (Quick-Step Floors) increased the peloton’s intensity 33km from the finish when he attempted to narrow down the 2:50 gap.
Along with Lotto Soudal, the teams fought for a spot at the front, with BMC closely behind. At that stage, Van Avermaet was in fifth position.
Quick-Step Floors stayed in the lead and, with 21 remaining, narrowed the gap to two minutes.
Van Keirsbulck, Cousin, Claeys and Perez stayed ahead and 12km from the finish the gap between them and the bunch was 1:20.
Seven kilometres from the finish Bora-Hansgrohe’s Lukas Postlberger controlled the pace at the front of the peloton, 54 seconds behind the leading four. It soon decreased to 45 seconds.
The bunch continued to close in and the gap was down to 39 seconds when they were 500 metres behind, only 5km to the finish.
A crash in the peloton caused Ilnur Zakarin (Katusha) and Lotto Soudal’s Tiesj Benoot to go down,
Dimension Data joined Quick-Step at the front of the peloton 2km from the finish when they were 12 seconds behind the leaders.
The bunch was almost in touching distance of the break when Van Keirsbulck powered away on his own.
Gaviria then opened up, with Greipel close behind, and proved his power by staying ahead.
“It was a very difficult victory. We didn’t have any help to control the breakaway today, but we really wanted to win and the team did an incredible job and we’re really happy,” said the stage winner.