It looked like the group would get away with the win easily until Israel - Premier Tech came to the front of the peloton. It didn't seem clear why the team has worked so much, but this time spent in the wind effectively removed several minutes from the gap and really made it hard for the front group to survive.
With 51 kilometers to go the action began in front with Mauro Schmid trying to stir things up, then Oier Lazkano doing the same... But with Israel's work in the front of the peloton they stopped attacking each and instead decided to work together to still have hopes of being able to do it.
On the penultimate hilltop we had Oier Lazkano, Harold Tejada and Luca Vergallito dropping the rest of the group, whilst the fight for positioning into the climb began. The peloton entered the climb at full speed, with a crash right at the base taking out Aleksandr Vlasov (but others affected).
Primoz Roglic attacked right in the very steep ramps at the base, but it then calmed down. João Almeida had been dropped whilst Jefferson Alexander Cepeda kept the pace high for Richard Carapaz.
With 2.5 kilometers to go Roglic attacked, followed by
Enric Mas, but Felix Gall brought it back for O'Connor. With 1.9 to go he went once again with Mas joining over whilst O'Connor was struggling. The duo caught the front of the race.
Mas took the front of the group in the technical finale but Roglic had the superior explosivity and sprinted for the stage win ahead of the Movistar rider.
Mikel Landa was third on the day.