Joaquin Correa sealed the three points for Lazio with six minutes remaining to extend their unbeaten league run to six matches and move into the Champions League places on 21 points, level with Atalanta and Cagliari.
“We won an important game, I think deservedly, against a side that in my view had a good performance, but Lazio played very well and did everything to win,” Lazio coach Simone Inzaghi told Sky Sport Italia.
“It’s a little premature after 11 games to talk about the table, but we are getting some consistency in terms of performances and results."
Milan have the players to surprise Liverpool in CL opener - Inside Europe
Stefano Pioli has picked up four points from his first four games in charge of Milan, since replacing sacked coach Marco Giampaolo in October.
Milan are stranded in 11th place with 13 points, having won just two of their last eight games, but the coach remains confident that they are heading in the right direction.
“In my view, the team is improving," he said.
"Of course, for the table and the situation, it was important to win, but the performance was there tonight.
“We took a few risks in order to create danger for the opponents, matching them all the way to the end, and I believe we are on the right path now.
“All we can do is keep improving along these lines. I saw a team that fought hard for 95 minutes. I did not see a team that was struggling, afraid or let their heads drop."
The game burst into life midway through the first half when Immobile curled a finish off the crossbar before Samu Castillejo’s rasping shot was palmed wide by a diving Thomas Strakosha.
Lazio took the lead soon after when Serie A’s leading scorer Immobile got on the end of Manuel Lazzari’s cross to head in his 13th league goal of the season.
Milan needed just three minutes to draw level as Lazio defender Bastos was left with his head in his hands after directing a cross into his own net off his chest.
The opportunities dried up after the break as the two teams tired, having played three games each in the space of a week.
But Lazio found the breakthrough when Luis Alberto slipped a pass into the box for Correa, who smashed a shot into the top corner
Pioli confirms Ibrahimovic to miss two games of Milan run-in
Pioli says Milan striker Ibrahimovic is fit to face Man United