Real Madrid coach Jose Mourinho marked his 100th UEFA Champions League game with a 1-1 draw at Manchester City that sent his side into the last 16 at City's expense.
City had to win to stand any chance of going through, so although Sergio Aguero's 73rd-minute penalty cancelled out Karim Benzema's early opener, the hosts went out in the group phase for a second successive season.
Real had Alvaro Arbeloa sent off, but with eight points - three less than Group D leaders Borussia Dortmund - they cannot be caught by either Ajax or City, who had not lost in their 19 previous European home games.
The English champions trail Ajax by a point and therefore must win at Dortmund in their final group fixture and hope the Dutch side lose in Madrid if they are to secure the consolation prize of a UEFA Europa League berth.
Mourinho, the youngest coach to reach the 100-match milestone, is now a step closer to delivering an elusive tenth European Cup to the Spanish champions, who have already fallen eight points off the pace in La Liga.
Benzema breaks the deadlock
City coach Roberto Mancini elected to deploy a three-man defence at the Etihad Stadium, but the home side's defenders did not seem comfortable with the system and Real were quick to profit.
In the tenth minute, Angel di Maria was given space to cross from the right and his centre found the unmarked Benzema, who cantered in behind Maicon to beat Joe Hart on the volley from close range.
With Maicon and Pablo Zabaleta on the pitch, the right side of City's defence should have been secure, but Cristiano Ronaldo found plenty of room there.
Roundly booed on his first appearance in the city since leaving Manchester United in 2009, Ronaldo twice reached the byline on Real's left, only for Sami Khedira to put both of his crosses wide.
Ronaldo was bearing down on goal again moments later, but Matija Nastasic got back to clear his goal-bound lob off the line and Hart parried his follow-up. Khedira darted through on goal after 24 minutes, only to miscue an attempted chip, which allowed Hart to save.
City changed their shape, with Zabaleta switching to left-back in a conventional back four, but they were unable to make inroads into the Real area.
Their best effort saw Iker Casillas forced to tip over a 25-yard effort from Aguero, who also teed up Maicon for a shot that dribbled wide.
Aguero levels the match
The hosts improved early in the second period, with Aguero heading over from Maicon's cross and David Silva shooting at Casillas after Arbeloa's clearance came straight to him.
Carlos Tevez was introduced on the hour but still fortune eluded City, with Aguero's close-range volley miraculously kept out by Casillas in the 64th minute.
The game turned eight minutes later, after Arbeloa was shown a second yellow card for a push on Aguero inside the Real area. Just as he had done in Saturday's 5-0 win over Aston Villa, Aguero converted the spot-kick, and City's last-16 ambitions appeared revived.
Tevez fired in a low shot that Casillas comfortably held, but despite five minutes of added time that prompted an incredulous reaction from Mourinho, there was to be no late drama.