Movistar rider Richard Carapaz won stage eight of the Giro d'Italia as Britain's Simon Yates retained the overall lead.
Carapaz became the first Ecuadorean to win a stage of a grand tour after launching a solo attack with around one kilometre remaining of the 209km route from Praia a Mare to Montevergine di Mercogliano.
Second-placed Davide Formolo finished seven seconds behind Carapaz after edging France's Thibaut Pinot into third and fellow Italian Enrico Battaglin into fourth.
Mitchelton-Scott's Yates, who has held the pink jersey since stage six, was fifth on Saturday and leads the race by 16 seconds from Tom Dumoulin (Sunweb).
The frantic finale came after Britain's Chris Froome suffered a scare when he came off his bike with just under six kilometres remaining.
Team Sky rider Froome, aiming to win a third successive grand tour, crashed on a slippery hairpin but managed to finish and sits ninth overall, a minute and 10 seconds behind Yates.