Real went ahead after 10 minutes when Karim Benzema was left unmarked and in space to score with the goal at his mercy, but City, outplayed in the first half, improved in the second and equalised with a Sergio Aguero penalty after 74 minutes.
Real defender Alvaro Arbeloa was sent off for fouling Aguero and conceding the penalty which the Argentine swept home having missed a golden opportunity to score in the 65th minute when Iker Casillas made a point-blank save.
Former Manchester United favourite Cristiano Ronaldo, playing back in the city for the first time since he left United three years ago, was booed every time he touched the ball, but had the last laugh as City went out.
Real's only disappointment might be qualifying as runners-up in the group after Borussia Dortmund grabbed top spot with a 4-1 win at Ajax Amsterdam.
"We wanted to fight for first place but it was not to be but the important thing is that we are through," Casillas said in an interview with Spanish TV.
"We missed a few chances to end the match as a contest in the first half but the truth is we were up against a great team.
"It's also true that we felt a bit discriminated against by some of the referee's decisions. But we'll focus on the positive which is that we are through to the next round."
Real ripped City's three-man defence to shreds until coach Roberto Mancini changed his formation to four at the back with Aleksandar Kolarov dropping deeper after half an hour.
With City needing to win, and Real dominating almost from the kickoff, there was a subdued atmosphere in the stadium from the start, and it got even quieter as Real created a series of good early scoring chances.
Ronaldo should have doubled the lead after 15 minutes when he broke free and lobbed Hart but instead saw the ball cleared off the line and when it came back to him he curled it narrowly wide.
Defensive midfielder Sami Khedira also had three opportunities to score and Benzema another one, while City, dominating possession somewhat aimlessly in midfield, never seriously troubled Casillas before the break.
Real's opener came after some suicidal defending by the English champions when Maicon failed to stop Benzema running in on Angel di Maria's cross.
Benzema broke free into space, stayed onside and had the simplest of chances to fire home unmarked from two metres out.
City improved after the break and were far more aggressive and dynamic but although the introduction of Carlos Tevez after an hour gave them renewed hope, Real never really relinquished the upper hand and held on for a deserved point.
Mancini's men were left ruing another early exit after their Champions League debut appearance last year ended at the same stage.
"We've had a few opportunities in this group where we could have done a lot better," City keeper Hart told Sky Sports television.
"All the games have cost us - we've lost our two away games and not won at home. We led in Amsterdam and we led in Madrid so it's been a bad campaign for us."
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.