Liverpool dominated the first half but found themselves behind at the break as two quick-fire goals from the visitors cancelled out an early own goal by Fikayo Tomori, who had deflected Trent Alexander-Arnold's strike into the back of the net. Mohamed Salah also saw a penalty saved midway through the half.
Milan started the second half well and saw a Simon Kjaer goal ruled out for offside before Salah began the Reds' comeback after latching on to a superb Divock Origi pass.
Both sides looked in no mood to concede a third but Jordan Henderson netted with an excellent strike from outside the box to turn the game back in Liverpool's favour and bag the Reds' first three points of Group B.
Jurgen Klopp made four changes to the side that beat Leeds at the weekend as Joe Gomez and Divock Origi made their first starts of the season, whilst Naby Keita and Jordan Henderson also returned to the starting eleven.
It was a raucous atmosphere at Anfield as supporters welcomed back a full stadium on a European night for the first time in over 18 months.
Liverpool looked to make a fast start as Andy Robertson found space down the left and fizzed in an excellent ball towards Origi, who was unable to make sufficient contact with the ball as his shot skewed past the far post.
Robertson continued to find joy as he created another opening, this time for Diogo Jota, who turned on to his left foot and fired goalwards from close range, only for the ball to be deflected behind.
Liverpool were rewarded for their lightning-quick start as Trent Alexander-Arnold exchanged passes with Mohamed Salah before bursting into the box and looking for a pullback, which deflected off Fikayo Tomori and into the back of the net.
A powerful Robertson effort hit the arm of Ismael Bennacer as the referee awarded a penalty in Liverpool's favour, but Salah was denied from the spot before Jota's follow-up was also saved by goalkeeper Mike Maignan.
The Reds were relentless as they continued to pile the pressure on Milan. The visitors remained pinned inside their own half barring a couple of brief forays forward and a second Liverpool goal felt like an inevitability, with Joel Matip and Salah both going close.
Stefano Pioli's side managed to stem the flow to a certain extent but a goal still looked out of reach with the Reds enjoying the ball for extended periods.
However, another lull saw the visitors spring a huge surprise as they turned the game on its head inside two minutes, scoring not just once but twice.
Ante Rebic fired home with Milan's first shot on target with a low shot past Alisson to level the scores before Leao's effort was blocked by Robertson only for Brahim Diaz to turn the ball into the back of the net to give Milan a shock 2-1 lead.
Milan thought they had netted a third inside the opening minute of the restart as Henderson missed his clearance from a corner and allowed Simon Kjaer the chance to prod the ball home, but the goal was disallowed for offside in the build-up.
But it didn't take long for Liverpool to get themselves back on level terms as good link-up play at the edge of the box by Origi saw the Belgian play Salah through on goal, with the Egyptian coolly putting prodding the ball past Maignan to make it 2-2.
Origi dragged an effort wide from just outside the area before a foul on him by Diaz saw him off leave the pitch in place of Sadio Mane, who went in search of his 100th Reds goal.
Jota, who moved into the middle following Mane's introduction, nearly put the Reds ahead after Joel Matip's burst forward saw the ball run to the Portuguese, but his effort hit Kjaer's foot and went behind.
The Reds made their moment count from the ensuing corner as the ball fell at the feet of Henderson outside the edge of the box, with the Reds skipper expertly placing his powerful effort into the bottom corner to make it 3-2.
Curtis Jones and Thiago came on to replace Keita and Jota soon after, with Jones coming close with a curling effort from outside the box after going on a mazy run.
With a little over three minutes on the clock, Kjaer's diving glanced header looked like it may have crept in at the far post or found a teammate, but Alisson was alive to the danger as he comfortably landed on the ball.
The Reds dug in late on as they secured their first three points of Group B, which looked a certainty in the opening 30 minutes but far from it ever since. Next up, Crystal Palace at home at the weekend...