Nine men eventually formed the break including notable riders such as Team Visma | Lease a Bike's Johannes Staune-Mittet, looking to make a success of the race after the abandonment of their leader on stage 4 abandonment.
After they were caught, Sepp Kuss showed his face at the front, attacking at taking some King of the Mountains points.
With around 30km to go, a counter-attack then formed, with Staune-Mittet again on the attack, this time joined by Michal Kwiatkowski, Remy Rochas, Ibon Ruiz and Mark Donovan.
Lidl-Trek, the team of the new overall leader, Mattias Skjelmose, were doing the work at the front of the bunch and keeping the leaders within sight.
Only the final climb of the day, things began to light up at the front of the peloton with the likes of Isaac del Toro, Bruno Armirail and Oscar Onley going on the attack, catching the likes of Rochas and Kwiatkowski in the process.
After relying on Tao Geoghegan Hart to get him close, Skjelmose worked hard to cover the moves and as the descent towards the line started, things were all back together.
Just over 6km to go, Brandon McNulty was the next to make his move, countering after teammate del Toro had been caught. The American also couldn't hold his lead though, as he too was caught.
With no team having numbers to keep things under control, it was relentless attack after attack heading towards the line.
Into the final kilometre though it was still altogether. Del Toro tried yet another move but was fruitless and into the home straight Carlos Rodriguez attempted an attack.
Once the sprint launched though, there was an incredibly close photo finish to sort out the winner in a blanket finish across the line. Romain Gregoire was awarded the win ahead of
Orluis Aular and
Max Schachmann.