NEWCASTLE, England (Reuters) -AC Milan substitute Samuel Chukwueze struck a superb late winner to seal a 2-1 victory over Newcastle United as both teams exited the Champions League in a nerve-jangling climax to Group F at St James' Park on Wednesday.
At one point, Newcastle were heading for the last 16 as they led through Joelinton's rasping first-half drive and Paris St Germain trailed in Germany to Borussia Dortmund -- one of the scenarios Eddie Howe's side required before kickoff.
But seven-times champions Milan, who had to win and hope for a PSG defeat to progress, improved in the second half as Newcastle ran out of steam and Christian Pulisic equalised on the hour from Olivier Giroud's pass.
With both sides desperate for the three points, Bruno Guimaraes had a shot tipped against the crossbar by Milan keeper Mike Maignan before Rafael Leao hit the post at the other end.
Milan had won only one of their previous 21 matches away to English opposition in Europe, in 2005, but Chukwueze made it a memorable night for them when he curled a sublime finish past Martin Dubravka in the 84th minute.
The final whistle saw tempers boil over as Newcastle's frustration was obvious, although Milan's joy was muted as PSG's 1-1 draw meant the French club were runners-up in the group with eight points, the same as Milan but with a better head-to-head record.
Milan enter the Europa League while Newcastle, who finished bottom with five points, are out of Europe. Dortmund topped the group with 11 points.
"We were dominant at times but probably needed the second goal. We didn't defend the two goals well enough," Howe told TNT Sports. "Both teams were desperate to win in the end. We had to be brave and they had to be brave.
"It made for a very good game but we're absolutely devastated not to go through."
Newcastle will reflect on the controversial last-gasp penalty they conceded in Paris last month which allowed Kylian Mbappe to salvage a vital 1-1 draw for PSG, although the English side's exit was as much about a long injury list which has stretched Howe's squad to breaking point.
They certainly did not lack energy in the first half as they fed off the energy of the Toon Army.
Miguel Almiron was denied a certain goal by a superb intervention by young England defender Fikayo Tomori as Milan struggled to get out of their own half.
When Joelinton was teed up by 17-year-old Lewis Miley in the 33rd minute before lashing a shot high past Maignan it felt like it could be a special night on Tyneside.
To their credit, Stefano Pioli's side looked rejuvenated after the interval and they equalised when Leao's low cross ended up at the feet of Giroud who cleverly shifted it on to another former Chelsea player Pulisic to fire into the net.
After PSG equalised in Germany, the mood of optimism in the stadium began to wane although when Leao's shot struck the post after he was played clean through it seemed there might still be a twist on the final night of group matches before the competition is revamped next season.
But it was not to be as Newcastle's first Champions League campaign for two decades ended in crushing disappointment.
For Milan, there is Europa League action to look forward to after Christmas.
"We needed to do our job and win. Then we waited for news from the other game," Leao said. "Now we are in the Europa League -- Milan have never won that and we want to."
(Reporting by Martyn Herman; editing by Clare Fallon)