Niccolo Bonifazio (Direct Energie) went first, almost catching a motorbike on the fast technical descent off the Cipressa. The Italian, though, was caught before hitting the bottom of the race's final climb.
Team Sky, led by Welshman Luke Rowe, hit the bottom of the Poggio hard, setting a blistering pace up the 3.7km climb which was simply too much for some, with many appearing to be pedalling in treacle.
Alberto Bettiol (EF Education First) hit out around 2km from the summit, but Alaphilippe was smart to the move and closed the Italian down taking with him Michal Kwiatkowski (Team Sky) and Peter Sagan (Bora-Hansgrohe).
World champion Alejandro Valverde (Movistar), European champion Matteo Trentin (Mitchelton-Scott), Oliver Naesen (AG2R-La Mondiale) and Wout van Aert (Jumbo-Visma) followed.
On the fast descent into Sanremo, defending champion Vincenzo Nibali and Bahrain-Merida teammate Matej Mohoric gave chase.
Trentin launched another attack around 2km from the line but was closed down by van Aert, who made an impressive debut.
Mohoric was next to go but the Slovenian champion's move soon fizzled out, leaving Sagan stuck in the worst possible position with 500m remaining: at the front of the race.
The three-time world champion, who had been struggling with illness in the race build-up, paid the ultimate price as he peered over his right shoulder looking for Alaphilippe.
Mohoric darted down the left, taking with him the in-form Deceuninck-Quick Step rider, who made easy work of the sprint to win the biggest one-day of his career, with Naesen and Kwiatkowski taking second and third.