A stunning header from substitute Junior Messias in the dying minutes handed AC Milan a 1-0 win over Atletico Madrid and kept alive their hopes of qualifying for the last-16 in the Champions League on Wednesday.
Milan arrived in Madrid rooted to the bottom of Group B with only one point and anything but a win against Atletico would have eliminated them from this season's competition.
Wednesday's result means the race to see who will join group winners Liverpool in the next round will go down to the wire. Porto, who are on five points, as well as Milan and Atletico, who are tied on four points, will have to wait until the final round of fixtures to decide who will finish second, and progress to the last 16.
Milan will host Liverpool while Atletico will travel to Porto on Dec. 7 for the final Group B fixtures.
On a freezing night in Madrid, a packed crowd at the Metropolitano Stadium failed to spur on Atletico, who struggled to make any kind of impact against a Milan side who showed urgency and aggression.
Brazilian Messias, who has completed a remarkable journey from working as a delivery driver and playing amateur football before slowly climbing the ladder , broke the deadlock in the 87th minute with a spectacular header after latching on to a perfect cross from Franck Kessie.
"They studied us really well and our gameplan didn't work," Atletico striker Antoine Griezmann told reporters.
"The Champions League is very difficult and Milan were superior in every aspect. We have to work, to get better..."
Milan controlled the game from the beginning, despite manager Stefano Pioli springing a surprise by starting Zlatan Ibrahimovic on the bench after he scored two goals against Fiorentina on Saturday.
The Swedish striker came on in the second half and almost scored a second goal in stoppage time, appealing unsuccessfully for a penalty after being caught by keeper Jan Oblak when he was about to shoot.
Atletico will finish the group stage having won none of their three home games, after losing to Milan and Liverpool and drawing with Porto.
"The Champions League does not forgive," Atletico Madrid manager Diego Simeone said.
"You only go through when you deserve to."