Richard Carapaz became the first Ecuadorian winner of the Giro d'Italia after safely negotiating the final individual time trial around Verona.
The 26-year-old Movistar rider held on to the pink jersey he first claimed after stage 14 a week ago.
Carapaz finished the 21st and final stage some 40 seconds behind stage winner Chad Haga (Sunweb) but he had plenty of time to play with as he crossed the line.
Italian Vincenzo Nibali (Bahrain-Merida) held on to second place in the final standings, while Carapaz's team-mate Mikel Landa fell short of the time set by Primoz Roglic (Jumbo-Visma) and dropped to fourth behind the Slovenian.
Belgian duo Victor Campenaerts and Thomas De Gendt finished the last stage in second and third behind American Haga, who completed the 17km time trial in 22mins 7secs.
Britain's Simon Yates clocked 23mins 7secs to hold on to his place in the top 10, finishing eighth overall.