The Serie A giants looked on track for a comfortable victory when they scored twice inside the opening 16 minutes, but the hosts equalised shortly after half-time.
 
Veteran goalkeeper Christian Abbiati produced a string of quality sides to keep his side on level terms before a Tomas Hubocan own goal gave the visitors victory.
 
The result sees Milan maintain second place in Group C of the Champions League with four points, two behind Malaga and three ahead of Anderlecht.
 
"It's an important victory, but I am convinced this group will only be decided at the very end," Allegri said.

"I have to praise the lads, as we kept looking for the win throughout the match.”

Stephan El Shaarawy's fantastic solo effort was the pick of the goals, although AC Milan's man-of-the-match was 35-year-old shot-stopper Abbiati.

"Abbiati made some great saves both in the first and second half," Allegri said.
 
"He is an excellent goalkeeper who in my two years here at Milan has done great things.
 
"Everyone makes mistakes sometimes, but a goalkeeping error is always highlighted more than any other."
 
Luciano Spalletti insists Zenit St Petersburg's Champions League dream is still alive despite picking up no points from their first two fixtures in the competition.

The former Udinese and Roma coach rued the mistakes of his side and also praised the performance of Abbiati.

"Abbiati made some amazing saves – he literally plucked some balls away from the net," he said.

"Unfortunately the individual incidents did not go our way tonight but when you make too many mistakes, eventually you have to accept defeat.

"We didn't play to our full potential... If you want to become a big team you have to play well for 90 minutes, especially in this competition."

The Italian coach questioned the mentality of some of his players and feels that his side now have to secure all three points in their crunch tie against Anderlecht later this month.

"I have a feeling that the players forgot about the importance of this game, they did not take full responsibility," Spalletti said.

"However, we are not out yet, we can still qualify, but we have to start playing better and winning games immediately.

"I would be very angry if anybody in the team thinks it's over after these two defeats."