|AC Milan's Zlatan Ibrahimovic, far right, tries to stop Mourinho's Real qualifying for the last 16 at the San Siro [AFP]
A last-gasp equaliser by Pedro Leon was enough to allow Real Madrid to join Chelsea and Bayern Munich in the last 16 of the European Champions League, while Arsenal, who could have joined them, will have to wait.
Real, attempting to win at the San Siro for the first time in their 14th attempt dating back to 1956, led AC Milan with a Gonzalo Higuain goal just before half time in their Group G match on Wednesday.
Two second half goals from substitute Filipo Inzaghi, however, looked like giving Milan a 2-1 victory and ruining Madrid manager Jose Mourinho's return to the city where he coached Inter to the European crown last season.
But a strike four minutes into stoppage time from Pedro Leon salvaged a 2-2 draw and a place in the last 16 for Real with almost the last kick of the game.
English champions Chelsea easily progressed after beating Spartak Moscow 4-1, scoring all their goals in a second-half masterclass.
Nicolas Anelka opened the scoring from an acute angle in the 49th minute before Didier Drogba, who was Chelsea's captain for the match, doubled the lead from the penalty spot in the 64th after being brought down by Evgeni Makeev.
Drogba then sent over the free kick that was put away by Branislav Ivanovic four minutes later and the centre back grabbed his second in injury time, securing the Blues a fourth successive win in Group F.
Chelsea are now undefeated at home in Champions League group play in 22 games.
Manager Carlo Ancelotti felt the goal by Anelka, the former France striker's tenth of the season and third in fourth matches, changed the complexion of the match.
"The first goal was fantastic and it was the most important goal of the evening,'' Ancelotti said.
"He (Anelka) is in the best form of his career.''
While Real, Bayern, Chelsea and Marseille were all celebrating, Arsenal let their chance slip and will have to wait to qualify.
Arsenal took the lead at Shakhtar Donetsk with a superb goal on the run from Theo Walcott, but Donetsk struck back to win 2-1 with Dmytro Chygrynskiy's deflected header and a second from former Arsenal player Eduardo as Arsenal dropped points for the first time.
A hat-trick from Mario Gomez gave Bayern, last season's runners-up, a comfortable 4-0 away win over CFR Cluj in Romania with their fourth successive win in Group E.
Gomez opened the scoring in the 12th minute by pouncing on a rebound from Cluj goalkeeper Eduard Stancoiu. He nudged in his second from close range in the 24th off a pass from Bastian Schweinsteiger, and completed the hat trick in the 71st from another Schweinsteiger ball. Thomas Mueller finished the rout in the 90th from close range.
"A shameful score. They deserved victory,'' Cluj coach Sorin Cartu said.
Bayern led the group with 12 points from four matches.
Andre-Pierre Gignac grabbed a hat-trick to help goal-happy Olympique Marseille to a record 7-0 Champions League away win at Zilina.
Third-placed Marseille's resounding victory gave them six points from four games in Group F and they only trail Spartak Moscow due to an inferior head-to-head record.