Cavani netted a first half penalty to open the scoring before Paolo Cannavaro's own goal on the half hour mark draw the visitors level.
The Uruguay international added his second on the hour mark, while German Denis capitalised on some lackadaisical Napoli defending to draw level before Pandev tapped home a late winner for the hosts.
Napoli started the brighter of the two sides and made their early dominance count following Luigi Giorgi's foul on Juan Zuniga in the 18 yard box as Cavani stepped up to fire his penalty past Andrea Consigli and into the bottom corner.
Atalanta looked to force their way back into the encounter minutes after the opener, but Denis' header was easily dealt with by Morgan De Sanctis.
Cavani could've added a second on the 15 minute mark having been picked out by Goran Pandev, only for the striker to guide his header wide before Pandev blasted over from close range for the hosts.
Napoli dominated and should have doubled their advantage on the 20 minute after Marek Hamsik played across to Cavani. The Uruguayan pushed into the Atalanta box, but could only direct his effort wide of the post.
Zuniga then picked out Hamsik, who headed over, before Cavani blasted a free kick over the bar from 25 yards out as Walter Mazzari's side looked to make their early pressure count.
Atalanta began to grow back into the encounter and rewarded for their efforts on the half hour mark as Cannavaro inadvertently put the ball past De Sanctis and into his own net.
The visitors could've added a second moments later after Carlos Carmona's free struck the woodwork before Hamsik forced a close range save Consigli at the other end.
Napoli began the second half the strong of the two teams again could've taken the initiative once again as Blerim Dzemaili saw his effort cleared off the line by Denis before Cavani headed wide moments later.
The Uruguayan did well to forge out a goal scoring opportunity on the hour mark, but was denied around the six yard box by some excellent last ditch Atalanta defending as the hosts struggled to create any clear cut chances.
Napoli made their second half pressure count in the 65th minute following some neat play in the 18 yard box from Cavani, who turned Guglielmo Stendardo, shepherded onto his right foot before he placed the ball into the bottom left corner.
Pandev came close to adding a third moments later, but his 20 yard drive was easily held by Consigli, while the Atalanta goalkeeper expertly palmed a Cavani effort away as the Partenopei pressed to secure all three points.
As the hosts pushed for a third, La Dea drew level following some poor goalkeeping from De Sanctis. Denis rounded the Napoli number one before he guided his effort past Cannavaro and into the far corner from a tight angle.
The hosts restored their one goal advantage with 10 minutes remaining as Pablo Armero picked out an unmarked Pandev in the six yard box to tap home as Napoli held on for all three points to keep their Scudetto hopes alive.