The San Siro hosts were rocked on the hour-mark when referee Paolo Valeri awarded Fiorentina a penalty, after Juan brought down Joaquin.
Giuseppe Rossi converted the spot-kick but Inter responded well; scoring twice in the final 20 minutes to secure the three points and send Mazzarri's men second on the table.
Mazzarri said, while the goal conceded was a setback, he was pleased his men could break down Vincenzo Montella's well-organised Fiorentina side.
"You could see we were affected for five minutes by that goal but then shook off the tension and at the end deserved this victory," Mazzarri told Sky Sport Italia.
"It was a struggle against a very strong team with real quality.
"Fiorentina play very tight and that makes it look as if they have more possession but the statistics showed it was in the end 52 per cent to our 48, so the difference was minimal.
"Their only real scoring opportunities were created by our mistakes, whereas we had the chance to finish off two really good counter-attacks in the first half alone."
Mazzarri said Inter's tactics to put the acid on Fiorentina failed.
"We tried pressing Fiorentina high up the pitch but they are so good in terms of technique that it was difficult to shake them up," the 51-year-old former Napoli head coach said.
"We need to grow but thankfully these lads are achieving something exceptional with the time I've had to impart my ideas.
"We do want to run a few more risks at the back by pressing our opponents, but it takes a little more courage than we have right now."
Fiorentina boss Montella echoed Mazzarri's notion that Thursday's visitors played well, with the loss leaving them three points shy of Inter in fifth spot.
"The only thing I didn't like was the result," Montella told Sky Sport Italia.
"It was a great performance with character and just as we thought we had it under control, we conceded two odd goals. I'll keep the performance and with it I have to keep the defeat.
"We carry on our principles of football against a tough opponent. We seemed to have the game in hand and a few ricochets went against us.
"We have players who need to grow but the team showed it is a team. It would be churlish to cling to injuries just because we lost.
"I think the first half was played at a high tempo and I saw Inter struggling as much as we were at the break.
"Up until their equaliser, Inter seemed to lack any insight or change of gear, so much that even the crowd started grumbling."
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.