Bittersweet night for Pioli as Milan end English curse in Newcastle
The seven-times champions came from a goal down to win thanks to Samuel Chukwueze's superb late goal just over a minute after he came on as a substitute.
It sealed Milan's first win against an English club away from home in European competition since 2005 and only their second in 22 attempts. But it was only good enough for third place in the group and a spot in the Europa League.
Had Milan won and Paris St Germain lost away to group winners Borussia Dortmund then Stefano Pioli's side would have reached the last 16 but PSG's 1-1 draw meant they edged through courtesy of a better head-to-head record.
"We're disappointed to have ended our run in the Champions League. We knew the group was tough but I believe we deserved more - we should have taken our chances in the other games," Pioli said. "We stayed in the game and played a great second half. Now we will do all we can to win the Europa League."
Former Chelsea forward Christian Pulisic equalised for Milan on the hour after Joelinton had given a dominant Newcastle the lead in the first half with a rasping drive.
"It's a massive accomplishment," Pulisic, who is the first American to score for three different teams in the Champions League, said. "We have a chance to win a great competition.
"Mixed emotions. We're pleased with the result and the performance in the second half. We needed a Dortmund win too but unfortunately, it wasn't to be tonight.
"The aim (before tonight) was to stay in Europe and we've managed to achieve that. Of course we wanted to continue in the Champions League but we look forward to Europa League."
Saudi-Arabia-owned Newcastle were in dreamland and heading for the last 16 when they led 1-0 and PSG trailed in Dortmund.
But a relentless season and a massive injury list caught up with them as they dropped off the pace in the second half.
Asked what he had learned from Newcastle's first foray in the Champions League for 20 years, manager Eddie Howe said: "So much. The value of the squad first and foremost, that's what's exposed us, the fact we haven't had the ability to utilise the squad we've created. We've gone into games very limited in what we can do and that hasn't helped us."
While Howe said missing out on the last 16 was devastating, the fact that his side are not even in the Europa League might be a blessing in disguise as they try to make up ground in the Premier League and qualify for next year's Champions League.
"You always have to use disappointment - the setbacks - as motivation and fuel for your fire," he said.
"We'll go back to the Premier League and try and do as much as we can to be consistent and stay up there."