There was just one shot on target in the first half as neither side could really get going, and the only drama came on the touchline when Gasperini was sent to the stands for complaining about his side not being awarded a penalty.
The hosts' Duvan Zapata got the scoring up and running in the 52nd minute with a far-post header, before Piotr Zielinski volleyed in an equaliser six minutes later.
Goals from Robin Gosens and the in-form Luis Muriel looked to have put the home side on course for a comfortable win, only for Gosens to put through his own net in the 75th minute to get Napoli back into contention.
Cristian Romero put the game to bed four minutes later, however, to put Atalanta up to fourth on 43 points, above fifth-placed Lazio on goal difference and one point clear of champions Juventus, who play Crotone on Monday, in sixth.
The defeat will increase the pressure on Napoli coach Gennaro Gattuso, with Napoli now down in seventh on 40 points, three off the top four.