The Italian national champion completed the race in 4:48:12, beating Trek-Segafredo’s Giacomo Nizzolo and world champion Peter Sagan of Bora-Hansgrohe in the final sprint.
Michal Kwiatkowski (Team Sky) retained his 14-second overall lead ahead of Alejandro Valverde (Movistar). Wilco Kelderman (Sunweb) is still in third place, a further 11 seconds back.
A breakaway formed almost from the outset, similar to what happened in stage two yesterday. Six riders went ahead – Nans Peters, Pierre Rolland, Jordi Simón, Antonio Molina, Luis Ángel Maté and Héctor Sáez.
Seven kilometres after breaking off they had created a two-minute-15-second lead from the peloton, then headed by Team Sky.
About 15km later and their lead had grown to three minutes. About a third of the way up the Madroño it had increased to four minutes.
However, by about 80km into the race their lead was back to two minutes. Maté managed to bag the King of the Mountain points.
Just over 100km in, the breakaway group held a one-minute-18-second lead as the six leaders looked as though they were out on a casual ride. The average speed of the day, at this point, stood at a low 35.1km/h.
Rolland dropped back to the peloton several kilometres later after getting a puncture. Quick-Step Floors now controlled the head of the peloton as they aimed to deliver one of the race favourites, Viviani, in a potential sprint finish.
The gap between the breakaway and the peloton was one minute with 46km to go.
The race started to see some action when Victor Campenaerts, Jelle Wallays and Lukas Postlberger pinged off the front of the peloton with under 40km to go and joined the breakaway group.
Simon surged ahead several kilometres later to take a lone lead, before being caught again. The nine riders thereafter held a 44-second lead with 30km remaining, before it dropped to 20 seconds with 24km to go.
Heading down a descent, Movistar took control of the peloton while Postlberger kicked ahead in the break and created a gap with under 20km left. Three kilometres later Héctor Sáez was dropped from the break.
Postlberger kept his solo lead with 13km left, before Gougeard attacked in pursuit of the Austrian.
With 6km to go the breakaway was finally caught and the field came together. A sprint finish seemed inevitable.
Movistar, with second-placed rider on the general classification Valverde, and Team Sky with red jersey wearer Kwiatkowski, lined up at the front with less than 5km left.
LottoNL, however, hit the front with one kilometre to go following a roundabout and were set to make their lead-out into the finish.
A string of attacks followed in the closing few hundred metres, before the Italian national champion came through to take the spoils on the line.