Valter Birsa's goal in the first minute of the second half gave Milan their first win in four league matches, and afterwards Allegri hailed a much-needed victory.
"We won a difficult and important game," he said.
"We needed this win after three matches with just two points. We also kept our first clean sheet and ran a few risks, aside from a header in the first half and some long-range shots we could have avoided.
"We had started fairly well and got to the byline, but then had the final pass wrong.
"We started the second half much better and could have had a second goal while defending in an organised fashion."
Birsa's strike from 20 yards was his first for the club, and Allegri paid tribute to the goalscorer.
"He is a good player with good technique who had already played well against Bologna and Napoli," he said.
"Obviously when the team loses then some players are likely to get blamed. He arrived from Genoa at the last moment and few knew him, but he can belong at Milan.
"I have a good squad at my disposal and we started badly in Serie A, but we are getting back on track."
After a lacklustre first half, Birsa's goal so early in the second period gave Milan the perfect boost, and Allegri revealed that there was no panic in the dressing room at half-time.
"There was no need to shout," he continued.
"At the moment when things are going badly you just need to reassure the lads. They have been putting in the effort and it’s a question of centimetres between a goal and a wasted chance.
"I think the players should be complimented, as even in difficulty and tired they were able to control the game."
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.