At 2-1 down, former City midfielder Brahim struck on 86 minutes before Jude Bellingham hit Real's winner in injury-time.
Brahim later said, "This isn't over yet, we still have to play the second leg. Of course, it's at home and it's a different story, that's much better. I'm really pleased with the win and how it came about. It was a really complete performance, I'm happy to have got the goal and to be able to help the team.
“I don't like to talk about justice. This is football, you can always play well and lose. I think we put on a very good display. It's never easy to come here, they're a pretty good side. We still have the second leg, our work isn't done yet. We capitalised on their mistakes and created a lot of chances. The team did a fantastic job, we competed really well against top opposition and we won it. This is Real Madrid, the greatest club in the world.
“I'm so happy at this club, it's where I've always dreamed of playing. I went on to celebrate because of where I am and what we're playing for, but I was at City for a good few years and I'm really grateful to them. I scored twice here a couple of years ago and they chanted my name, so I had to show a bit of respect."