The main pack was split into two groups when riders went down with less than two kilometres to go in the 130-kilometre leg and less than a dozen riders were left in front to contest the sprint.
Cavendish, who rides for the Omega Pharma-Quick Step team, finished in two hours 58 minutes 38 seconds on the circuit in downtown Naples, which featured a long, flat finishing straight. The Isle of Man rider has now won a combined 37 stages at the Giro, Tour and Vuelta — cycling's three Grand Tours.
Defending champion Ryder Hesjedal of Victoria, and other overall favourites Bradley Wiggins and Vincenzo Nibali, finished safely in the main pack. All of the riders who finished in the main pack were given the same time as the winner courtesy of the neutralizing rule for crashes in the final kilometres.
Elia Viviani, an Italian with Cannondale, crossed second, and Nacer Bouhanni, a Frenchman with FDJ, was third.
It was the 11th Giro stage win of Cavendish's career and his 98th victory overall. He'll wear the overall leader's pink jersey in Sunday's second stage, a team time trial on the nearby island of Ischia.
With time bonuses of 20, 12 and eight seconds handed out to the top three finishers, Cavendish took an eight-second lead on Viviani in the overall standings.
It will mark the fourth time Cavendish wears the pink jersey. He wore it for two days in 2009 when his former team Columbia won the opening team time trial and for one day in 2011 after a stage win.
"I've worn it before at the start but that was thanks to my team," Cavendish said. "I really wanted to win this here in Napoli. ... Now I want to go for a pizza."
Cavendish didn't have any teammates helping him in the finish but he used the crosswind to good effect and burst in front just before the line.
"I'm lucky I have the speed to be able to come like that in the final," he said
The course featured two mild climbs in the Posillipo neighbourhood and several loops down the finishing straight alongside the bay.
On a warm spring day, fans came out en masse to watch the race. Some even brought their dogs, one of which nearly tripped up some riders on a sharp corner after slipping under a barrier lining the road.
With the roads narrow in areas and stretches of cobblestones, there were several crashes. Among those who hit the asphalt early on were Laurent Pichon of France, Matteo Rabottini of Italy and Miguel Minguez Ayala of Spain.
Italians Mattia Gavazzi and Davide Apollonio, plus Belgian Klaas Lodewyck, were involved in the crash near the end that split the group, although they appeared to escape serious injury.
"Some guys took me with them and I crashed into the barriers," Lodewyck said.
Cavendish attributed the crashes to hairpin turns after long, wide straightaways.
"Circuit races always have crashes but it's nice to have circuit races for the fans," Cavendish said. "This is probably the most chaotic city I've been to so to clear the traffic from the city centre I've really got to take my hat off to the organizers."
There were a couple of groups of early breakaway riders and the last man caught by the main pack was Cameron Wurf, an Australian with Cannondale, with about 20 kilometres to go.
Cavendish's Omega team led the chase.
Sunday's team time trial from Ischia to Forio lasts 17.4 kilometres.
While Omega is without its time trial specialist Tony Martin, Cavendish is hoping for a solid performance.
"We're going to do everything we can to keep it," he said of the pink jersey.
The race ends May 26 in Brescia.