The 26-year-old Deceuninck-QuickStep rider beat Astana’s Jakob Fuglsang and Jumbo-Visma’s Wout van Aert into second and third respectively.
With 73km remaining of the 184km race, Team Sky’s Diego Rosa and AG2R La Mondiale’s Nico Denz were leading the race.
Rosa proved the stronger of the two and soon dropped Denz.
A group of 15 riders then moved clear of the rest of the peloton. This group comprised Tim Wellens, Tiesj Benoot, Alaphilippe, Zdenek Stybar, Yves Lampaert, Greg van Avermaet, Van Aert, Alexey Lutsenko, Maximilian Schachmann, Fuglsang, Simon Clarke, Alberto Bettiol, Romain Seigle, Robert Power and Toms Skujins.
Rosa had a gap of 45 seconds to this chasing group with 43km to the finish. The gap had dropped to 18 seconds 6km later.
With 36.5km remaining, Rosa was caught by the group, which had a one-minute gap to a second group comprising Vincenzo Nibali, Geraint Thomas, Pieter Serry and Roman Kreuziger.
Fuglsang later attacked, with Van Aert and Alaphilippe following. Going into the final 20km these three riders led the way by 25 seconds, but a short while later Van Aert was dropped.
Fuglsang and Alaphilippe had 45 seconds on the rest with Van Aert in between. With 14km to the finish they had a gap of one minute and five seconds over the rest of the chase.
With 10km to go Fuglsang and Alaphilippe led Van Aert by 35 seconds and the rest of the chase group by one minute and 25 seconds.
Van Aert closed the gap to 22 seconds with 4km to the finish line in the Piazza del Campo. Soon afterwards he shot past this duo and led onto Via Santa Catarina with Alaphilippe behind.
Fuglsang attacked and Alaphilippe immediately responded. Alaphilippe, who won last year’s La Flèche Wallonne and Tour of Britain, then had a small gap and took it into the last corner without any mistakes, which resulted in him claiming the victory.
“My team did a great job in protecting me,” said Alaphilippe.
“Jakob was very strong but I made no mistake. However, I wasn’t confident in winning until the last corner. This is a wonderful victory.”