It was close but Caleb Ewan (Orica-Scott) proved the victor over Fernando Gaviria (Quickstep-Floors) and Sam Bennett (Bora-Hansgrohe)
It's been a frustrating week for 22-year-old Ewan, missing out on victories he knew he should take, but determination brought him over the finish line in Alberobello.
"This win has probably brought me more joy than any other," Ewan said. "Everyday I didn't get a win, I felt the pressure build so to finally get the victory it feels pretty good."
"This is the best way to repay my teammates who have been working so hard for me. We went early, but that was the plan, and they just stayed so confident and so calm. They did a fantastic job today."
"It was probably one of the more hectic finals I've done at the Giro," Ewan said. "We knew we wanted to be in front in those final corners so I hit out earlier than I usually would. It meant I could take the best line to the finish and luckily I held on."
"Even after the past days I knew it wasn't my form that was in doubt, I just needed a bit of luck. Today the team were awesome again and all I had to do was that last sprint to the line."
Andre Greipel's Lotto-Soudal sprint train was unable to successfully navigate the difficult final four kilometres, particularly the final 500 metres where the road narrowed into a sharp right hand bend. The German crossed the line in fourth after finding himself boxed in. He took to Twitter to criticise the finale.
The rest of the 224 kilometre stage was a tame affair. Giuseppe Fonzi (Wilier Trestina), Dimitri Kozonchuk (Gazprom-Rusvelo) and Simone Ponzi (CCC) pulled clear in the opening kilometres near Castrovillari.
Ponzi sat up and fell back to the peloton after 39 kilometres, the other two holding on until the catch was made with 20 kilometres to go, their maximum advantage of five minutes progressively chipped away at over the preceding grind.