What was set to be a harrowing night became a memorable one for Manchester City as Leroy Sané’s late equaliser and Raheem Sterling’s 90th-minute winner gave them a famous win.

It meant that despite ending the game with 10 men following Nicolás Otamendi’s red card, and so being without him and the suspended Fernandinho for the second leg, they remain favourites to progress to the quarter-finals.

All of this came despite a controversial VAR decision to award Schalke the first of two penalties that had appeared likely to give them victory.

Quick guide Follow Guardian sport on social media Show Hide Twitter: follow us at @guardian_sport Facebook: like our football and sport pages Instagram: our favourite photos, films and stories YouTube: subscribe to our football and sport channels Photograph: Chesnot/Getty Images Europe

For Sané, a former Schalke player, his strike – a stunning 85th-minute free-kick – was particularly sweet. “It means a lot. I was a little bit sad for Schalke because the atmosphere was amazing like it always is,” he said. “You can see the will is a lot, we never give up, we always want to keep fighting.”

Pep Guardiola’s notable selection move was deploying Fernandinho at centre-back, as he did for this month’s win over Arsenal. There were two changes from the 6-0 Premier League hiding of Chelsea, with the injured John Stones replaced by Otamendi and David Silva chosen ahead of Oleksandr Zinchenko, who dropped to the bench.

Domenico Tedesco, Schalke’s 33-year-old coach, selected the former City centre-back Matija Nastasic, with Rabbi Matondo, who left the Etihad last month, as a substitute.

At a packed and vibrant Veltins Arena, Sergio Agüero made a hash of the first chance, mistiming a shot, then a slick free-kick routine that wrong-footed the defence ended in an Agüero header being tipped over by Ralf Fährmann. A second corner followed and, though Schalke cleared, they looked shaky.

Play Video 0:46 Pep Guardiola: 'Still we are not ready to fight for the Champions League' – video

A factor here was Tedesco arranging Schalke in a 5-4-1 that invited City on and meant ceding the initiative. The invitation to play attack-versus-defence soon led to an Agüero pot-shot and the City midfield of Raheem Sterling, Ilkay Gündogan, David Silva, Kevin De Bruyne and Bernardo Silva took control. Schalke were restricted to aerial attacks, as when Daniel Oczipka’s cross tested Fernandinho, who headed clear.

When City took the lead they had David Silva’s persistence to thank. After Schalke played themselves into difficulties, he hunted down Salif Sané, stole the ball and squared it to Agüero, who did not miss.

City soon came close to doubling the lead. Fernandinho made an interception and strode forward before delivering a defence-shredding ball into David Silva. The Spaniard turned this to Sterling but, instead of taking aim, he dawdled and his return to David Silva allowed the hosts to escape.

City looked far from watertight, though, when Schalke actually came at them. There was the concerning sight of Aymeric Laporte going to ground as Weston McKennie roved into the area and, though he did not touch the American, the Frenchman received a stern talking-to from Guardiola.

Facebook Twitter Pinterest Schalke forward Guido Burgstaller, left, grimaces in pain as referee Carlos del Cerro, second left, shows a red card to Manchester City defender Nicolás Otamendi. Photograph: Martin Meissner/AP

Then disaster struck and it followed De Bruyne losing possession – a collector’s item – near halfway. This led to a shot from Caligiuri, at which point VAR intervened.

The effort hit Otamendi’s right arm and Schalke appealed for a penalty. There followed near-farce as, while awaiting the verdict, the referee, Carlos del Cerro Grande, had a long chat with the captains, Fährmann and David Silva. Finally, after a three-minute delay, Del Cerro Grande pointed to the penalty spot and Nabil Bentaleb sent Ederson the wrong way.

Nor was this the end of the first-half drama. At a free-kick Fernandinho was booked for pulling back Salif Sané – meaning he misses the return leg – and a second penalty was awarded. Up stepped Bentaleb again to give Schalke a 2-1 lead.

City had to regroup for the second half. They began brightly, with De Bruyne’s snap-shot followed by a City break when Agüero found Sterling, who ran up a blind alley and was dispossessed. Agüero was culpable of the same error a little later.

The Fiver: sign up and get our daily football email.

But these chances derived because City pinged the ball around in the manner their manager always demands. Lacking was end product. Composure before goal had to be rediscovered yet the quality was absent when Otamendi felled Guido Burgstaller on 68 minutes and was shown a second yellow.

Towards the end Guardiola replaced Agüero with Sané and it was the German, with that superb long-range set piece, then Sterling, collecting Ederson’s long pass and poking neatly past Fährmann as the clock ticked towards 90 minutes, who made the trip home for City far more enjoyable.