The Partenopei cut the gap at the summit of Serie A back to nine points following an enthralling fixture at the Stadio San Paolo.
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 capitalized 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 its 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 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 the advantage on the 20-minute mark 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 its early pressure count.
Atalanta began to grow back into the encounter and was rewarded for its 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 6-yard box by some excellent last ditch Atalanta defending as the hosts struggled to create any clear cut chances.
Napoli finally got its second goal in the 65thminute following some neat play in the box from Cavani, who turned Guglielmo Stendardo and 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 No. 1 before he guided his effort past Cannavaro and into the far corner from a tight angle.
The hosts had the final say with 10 minutes remaining, though, as Pablo Armero picked out an unmarked Pandev in the 6-yard box to tap home as Napoli held on for all three points to keep its Scudetto hopes alive and slice Juventus' lead atop Serie A to nine points.