City advanced with two goals in the first 11 minutes through a header from Kevin De Bruyne and a shot by Gabriel Jesus.
Karim Benzema reduced the difference for Real in the 33rd minute, then Phil Foden restored the two goals difference for the hosts in the 53rd minute.
But after only two minutes, Vinicius Junior ran from the left side and quickly penetrated into the penalty area and reduced the difference again.
Bernardo Silva fired a powerful shot to boost City’s lead in the 74th minute, but Benzema scored his second personal goal from a penalty kick 8 minutes before the end of normal time.
Despite the four-way win, City could bemoan a slew of chances over the course of the two halves.
The return match will be held in Madrid next Wednesday.
Liverpool will play Villarreal in the other first leg of the semi-final at Anfield on Wednesday.