The Partenopei boss has explained he had to have a word with the misfiring Uruguay international, who then went on to net a crucial second-half strike
The Uruguyan had endured a frustrating opening 45 minutes at the San Paolo, having missed a succession of gilt-edged chances to cancel out Victor Ibarbo's opener for the visitors.
However, Cavani finally found the back of the net during a stirring second half which ended with Lorenzo Insigne netting a last-gasp winner for the second-placed Partenopei.
"Cavani missed opportunities that he normally finishes," Mazzarri told Sky Sport Italia in his post-game interview. "I had to calm him down during the interval.
"He was angry with himself and then I told him to be keep calm. In the second half, he improved and he even managed to score a goal."
Mazzarri was more grateful for Insigne's intervention, given he had feared his side would drop two precious points in their bid for automatic qualification for next season's Champions League.
"It seemed today that the game was cursed, but I don't believe that there is any doubt that we deserved the three points," the Tuscan coach argued.
"We suffered because we have missed too many chances; we risked throwing away important points.
"Tactically, I decided to risk it all: we had four strikers on the pitch at the end."
Napoli's win means they now sit seven points above third-placed AC Milan, who face Juventus on Sunday evening.