Eljif Elmas netted the decisive goal 11 minutes from the end at the Gewiss Stadium in Bergamo after Khvicha Kvaratskhelia's headed opener for the away side on the stroke of half-time was levelled by a similar strike from Ademola Lookman.
North Macedonia midfielder Elmas rolled home the winner from substitute Victor Osimhen's pass following Atalanta goalkeeper Marco Carnesecchi's poor clearance, making sure that Napoli stayed fourth.
Mazzarri's team are still seven points behind leaders Inter Milan who travel to Turin on Sunday for the weekend's big match at second-placed Juventus.
"The team dominated all last season, playing some of the best football in Europe with players who were not used to being in that position," Mazzarri told DAZN.
"There was always going to be some drop-off after that."
Mazzarri returned to Napoli last week after Rudi Garcia was sacked, reprising a role he left just over a decade ago after being the man to take southern Italy's biggest club back to the upper echelons of Italian football.
The 62-year-old guided Napoli to the 2012 Italian Cup, beating undefeated league champions Juventus in the final to win the club's first major trophy in over two decades, and to second in Serie A one year later before leaving for Inter Milan.
And he took three points from Saturday's even clash, his team recovering from Lookman's 53rd-minute equaliser and being saved from going behind in the 68th minute when Mario Pasalic's finish was ruled out for Teun Koopmeiners straying offside.
Mazzarri will also be boosted by Osimhen recovering from his hamstring injury in time for Wednesday's Champions League trip to Real Madrid.
Napoli are second in Group C, five points behind leaders Madrid and four ahead of third-placed Braga, who take on Union Berlin, with two games remaining.
"I didn't need to be in charge of Napoli to know that Osimhen is a great striker, I'd already seen him play," said Mazzarri.
"I hope he gets back to his best form back as soon as he can."
Hernandez sinks Fiorentina
Napoli were briefly third but Milan moved back above their rivals thanks to Theo Hernandez's penalty in a win in which 15-year-old Francesco Camarda became the youngest ever player to play in Serie A.
France full-back Hernandez calmly slotted home from the spot in first-half stoppage time after being brought down by Fabiano Parisi.
That was the highlight of an underwhelming performance from Milan, who were without suspended Olivier Giroud, Noah Okafor, star man Rafael Leao and others.
Portugal winger Leao will also miss Tuesday's visit of Borussia Dortmund which could be crucial to Milan's Champions League hopes.
A host of absences led to teen attacker Camarda being called up from Milan's youth ranks and brought on with seven minutes remaining, replacing Luka Jovic who moments before missed a golden chance to net his first goal for the club.
And deep in stoppage time Mike Maignan saved the win with a stunning stop to deny Rolando Mandragora just as the Italian looked certain to equalise from inches out.
Maurizio Sarri suggested he could quit Lazio after his team fell 2-1 at the division's bottom team Salernitana, losing thanks to a wonder strike from old boy Antonio Candreva.
Lazio are 10th in Italy's top flight, on 17 points, following their sixth defeat of what has been a difficult league season after finishing second last term.
"If it turns out that I'm the problem I'll take responsibility and I'll tell the owner to make a change," Sarri told reporters.
Former Italy winger Candreva played for over four years at Lazio where he won the 2013 Italian Cup in a dramatic final against local rivals Roma -- the only major title of his career.