Lowly Malaga among elite 16
City stare at elimination; Real held 2-2
Former winners Porto and impressive debutants Malaga became the first teams to reach the last 16 of the Champions League when they guaranteed progress from the group stage with two games to spare on Tuesday.
Group A leaders Porto, the 1987 and 2004 European champions, drew 0-0 away at Dynamo Kiev to move on to 10 points from four games and secure a knockout round place.
Qatari-owned Malaga continue to surprise in their first season mixing it with the continent's elite, a 1-1 draw with seven-times champions AC Milan at the San Siro moving the Andalusian club on to 10 points in Group C.
Borussia Dortmund were on the verge of qualifying from Group D until Mesut Ozil's superb curling freekick a minute from time secured hosts Real Madrid a 2-2 draw.
Dortmund (eight points) and Real (seven) remain favourites to progress after Manchester City and Ajax Amsterdam also drew 2-2, the Premier League champions hitting back from two goals down inside 17 minutes to retain their slim qualifying hopes.
Siem de Jong's double put the Dutch side in control before City, who failed to get beyond the group stage on their debut in the competition last season and who prop up the standings on two points this time, levelled through Yaya Toure and Sergio Aguero.
Goals from Klaas-Jan Huntelaar and Jefferson Farfan rescued Group B leaders Schalke 04 as they hit back from 2-0 down to draw 2-2 at home to Arsenal, who had led through Theo Walcott and Olivier Giroud and stay a point behind in second.
Olympiakos Piraeus also remained in contention in the section by beating visitors Montpellier 3-1.
Chilean Pellegrini has spearheaded Malaga's campaign after a close season of uncertainty sparked by rumours of an exit by their Qatari owner and a fire sale of top players.
Portuguese fullback Eliseu was played in by Isco to fire the Spaniards ahead five minutes before halftime. Milan improved in the second period and levelled in the 73rd when Alexandre Pato headed home, the first goal Malaga have conceded in the group.
Milan sit second on five points, ahead of Anderlecht (four) and Zenit St Petersburg (three) after the Belgian side won 1-0. Dortmund kept Cristiano Ronaldo quiet at the Bernabeu where they twice led against Real, only to be pegged back late on.
Marco Reus volleyed the German champions ahead in the 28th minute before Pepe equalised with a header six minutes later and Real's Alvaro Arbeloa poked the ball into his own net on the stroke of halftime. Real piled on the pressure and Ozil's exquisite set-piece which went in off the post with keeper Roman Weidenfeller slow to get across his goal.
Manchester City manager Roberto Mancini could find himself in hot water with UEFA after storming on to the pitch to remonstrate with Danish referee Peter Rasmussen after the draw with Ajax.
Mancini was livid that Rasmussen had disallowed a late Sergio Aguero "goal" and refused to award a penalty after a strong claim by City's Italy forward Mario Balotelli, who had to be forcibly prevented from approaching the official.
Paris St Germain look set to accompany Porto from Group A after thumping visitors Dinamo Zagreb 4-0, Sweden striker Zlatan Ibrahimovic having a hand in all four goals.
Results: Group A: Dynamo Kiev drew Porto 0-0; Paris St Germain bt Dinamo Zagreb 4-0. Group B: Schalke 04 drew with Arsenal 2-2; lympiakos Piraeus bt Montpellier HSC 3-1. Group C: Anderlecht bt Zenit St Petersburg 1-0; AC Milan drew with Malaga 1-1. Group D: Manchester City drew with Ajax Amsterdam 2-2; Real Madrid drew with Borussia Dortmund 2-2.