Movistar's Andrey Amador took the Giro d'Italia overall lead as Team Sky's Mikel Nieve won Friday's stage 13.
The 29-year-old becomes the first Costa Rican to lead a Grand Tour.
Spaniard Nieve, 31, raced to victory from Movistar's Giovanni Visconti over a route featuring steep climbs from Palmanova to Cividale del Friuli.
Bob Jungels led heading into the stage, but Amador finished among favourites Vicenzo Nibali and Alessandro Valverde to open a 26-second gap.
"I didn't really imagine it, I didn't think it could happen. I'm really happy to have this jersey," Amador told Eurosport.
"They have always supported me in Costa Rica, and this jersey is dedicated to all of them."
Stage 13 result:
1. Mikel Nieve (Spa/Team Sky) 4hrs 31mins 49secs
2. Giovanni Visconti (Ita/Movistar) +43secs
3. Vincenzo Nibali (Ita/Astana) +1min 17secs
4. Alejandro Valverde (Spa/Movistar) same time
5. Rafal Majka (Pol/Tinkoff)
6. Stefan Denifl (Aut/IAM Cycling)
1. Andrey Amador (Crc/Movistar) 54hrs 05mins 50secs
2. Bob Jungels (Lux/Etixx-Quick-Step) +26secs
3. Vincenzo Nibali (Ita/Astana) +41secs
4. Alejandro Valverde (Spa/Movistar) +43secs
5. Steven Kruijswijk (Ned/LottoNL) same time
6. Rafal Majka (Pol/Tinkoff) +1:37secs