Phil Foden's goal at the Bernabeu was his 22nd of the season for Manchester City
Pep Guardiola's side took the lead in the second minute when Bernardo Silva cleverly snuck a 25-yard free-kick round the wall past goalkeeper Andriy Lunin.
Two deflected strikes brought 14-time European Cup winners Madrid level. First Eduardo Camavinga's long-range effort hit Ruben Dias and spun into the far corner of Stefan Ortega's goal, before Rodrygo got in behind the City defence and poked home via Manuel Akanji's heel.
City were dominant in possession throughout under the closed roof of the Bernabeu but lacked quality in the final third - until Phil Foden stepped up.
The England midfielder had been on the periphery of the game but found space just outside the area to turn and fire into the top corner to pull City level.
Moments later left-back Josko Gvardiol cut in and found the far corner with a superb right-foot shot to score his first goal since joining City from RB Leipzig in the summer.
However, Madrid equalised with a stunning volley from Federico Valverde to set up an intriguing second leg on Wednesday, 17 April at Etihad Stadium, where City beat Madrid 4-0 in last season's semi-finals.
There was late concern for City though, with Foden hobbling after a late tackle on his ankle.
Foden allayed fears of a serious injury, telling TNT Sports he had a "bad dead leg" and was hopeful of being fit for Saturday's Premier League home game against Luton.
-- Courtesy of BBC Sport