Cavani, who ended his goal drought, 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 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 after 20 minutes when 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 in confidence and were rewarded for their efforts on the half-hour mark as Cannavaro inadvertently put the ball past De Sanctis into his own net.
The visitors could've added a second moments later after Carlos Carmona's free kick struck the woodwork before Hamsik forced a close range save out of Consigli at the other end.
Napoli began the second half the stronger of the two teams and 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 box from Cavani, who turned Guglielmo Stendardo, shepherded the ball onto his right foot before he placed it 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 three points.
As the hosts pushed for a third, Atalanta drew level following some poor goalkeeping from De Sanctis. Denis rounded the Napoli No.1 before he guided his effort past Cannavaro 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 three points to keep their Scudetto hopes alive.