The Ecuadorian finished the 131km stage from Saint-Vincent in 4:02:23 while Britain’s Simon Yates came in one minute and 32 seconds later.
Italian Vincenzo Nibali (+0:01:54) won the chasing group’s sprint to claim the third spot on the podium.
Carapaz dug deep on the descent of the final major climb of the day, the Colle San Carlo, to go clear from the leading group of seven, which included Polish Rafal Majka, Nibali, Slovenian Primoz Roglic, Columbian Miguel Angel Lopez and Spaniard Mikel Landa.
The remaining six, who were later joined by Yates and American Joe Dombrowski, tried to close down the gap that grew to 1:50 at around 3km to the finish.
Mitchelton-Scott’s Yates attacked at the 2.7km mark and tried to chase down Carapaz.
But the Movistar rider was unstoppable and grabbed a solo win, which gave him the overall lead from Jumbo-Visma’s Roglic, who was tipped to take over the maglia rosa today. Nibali lies third in the general classification.
Carapaz said afterwards they (his team) had used a strategy that had been well planned.
“We knew that Mikel Landa and I were in good form so we had to catch the right moment to attack. I did everything as planned.”
He added that it was difficult to believe he was in the lead and that it was a dream come true for which he had worked hard.
In other news, Team Sunweb’s Sam Oomen has abandoned the tour, leaving the team with only four riders after their leader Tom Dumoulin pulled out on stage five due to a knee injury.