For a long while Manchester City had it sewn up. Or, at least, they thought they had. Blue smoke bombs were being let off. The first euphoric chants of “championees”, could be heard and the Etihad was overdosing on schadenfreude given the history of these teams and the prospect of a title-winning victory that would have meant so much in this divided city.

What followed was extraordinary. Manchester United scored, quickly added another and then one more to complete an improbable feat of escapology against the Premier League’s champions-in-waiting. From 2-0 down to 3-2 up in the space of 16 second-half minutes – the game had been turned upside down and, at the final whistle, the television cameras even picked out a few home supporters in tears.

Reminder: City are 13 points clear at the top of the table. Mourinho congratulated them afterwards for winning the title.

It was a wild, eccentric derby and one of the stirring United comebacks from a team, in Sir Alex Ferguson’s day at least, that used to make a habit of these kind of thrilling recoveries. United, to put it bluntly, were abysmal in the first half. Vincent Kompany and Ilkay Gundogan had both scored for City and it could easily have become a rout if Raheem Sterling had not been having one of those days when he seemed to confuse the measurements of David de Gea’s goal with a particularly troublesome barn door. Sterling’s misses did not feel so consequential at the time, with City winning 2-0, but they did by the end.

United certainly rode their luck bearing in mind the two incidents when penalties should have been awarded against Ashley Young – the second one, at 3-2, a studs-up lunge on the substitute Sergio Agüero that should also have resulted in a red card – but it was a triumph, ultimately, for the strength of personality within Mourinho’s team and if City defend this way against Liverpool on Tuesday their chances of reaching the Champions League semi-finals are somewhere between minimal and non-existent. This is the first time in Guardiola’s coaching career that one of his teams have conceded three goals in successive matches and Nicolás Otamendi, in particular, was badly exposed during the period of the game when Paul Pogba scored twice and Chris Smalling turned in the winner.

Ashley Young plants his studs on Sergio Agüero’s shin but Manchester City’s furious penalty claims fell on deaf ears. Photograph: Manchester City FC/Man City via Getty Images

Until that stage, Pogba was part of a midfield that was being over-run and Alexis Sánchez had found it difficult to make any kind of favourable impression.

Yet the game swung on the moment, five minutes into the second half, when Gundogan’s shot flicked off the angle of crossbar and post. After that, United’s A-listers seemed to remember they were supposed to be elite performers. Pogba demonstrated his more attractive qualities and Sánchez – involved in all of his team’s goals – chose a good day to remind everyone why United made him the best-paid footballer in the land.

For Guardiola, it must have been startling to see the way City unravelled once Sánchez had drawn Otamendi out to the right wing and then swivelled away from him to help create Pogba’s first goal. Ander Herrera chested Sánchez’s cross into Pogba’s path and once the Frenchman had aimed his shot beyond Ederson it was remarkable how quickly the game swung United’s way.

Two minutes later, Sánchez crossed from the left and Pogba eluded Otamendi to equalise with a precise header. Smalling’s goal was another cross into the penalty area, this time from Sánchez’s free-kick, and the centre-half was completely alone as he side-footed his shot into an exposed net.

For all the praise they have attracted this season, City have not actually kept clean sheets in successive home matches since September. Their vulnerabilities at the back can often be overlooked when they attack so beautifully. Yet the last two games have shown how susceptible they can be against top-level opposition and this was one occasion when Mourinho could never be accused of ultra-defensive tactics. As Jürgen Klopp said last week, sitting back is not the way to hurt City. From Mourinho, there was no parking of the bus.

Paul Pogba beats Ederson to launch United’s incredible comeback. Photograph: Simon Stacpoole/Offside/Getty Images

Guardiola chose not to blame the referee, Martin Atkinson, in his post-match analysis. Indeed, he had to ask his press officer for the referee’s name, which made a refreshing change compared to the response it might have incurred had it been Mourinho in that position. Yet there was nothing of note from City’s manager to explain why and where it went wrong and, by the final whistle, this was one of the few occasions since he Guardiola joined the club that a few supporters behind the dugout could be seen taking exception with his decisions. Only a few – but still noticeable.

Guardiola had taken the calculated gamble of starting with Kevin de Bruyne on the bench. Gabriel Jesus and Kyle Walker were also rested with Tuesday’s game against Liverpool in mind and Guardiola resisted any temptation to fast-track the fit-again Agüero into the starting lineup. Yet it scarcely seemed to matter when Kompany powered in Sané’s corner and five minutes later Gundogan swivelled past Nemanja Matic to stab in City’s second goal.

At 2-0, the mood was euphoric. City were on course to win the league with six games to spare. No side would have done it any earlier, date-wise, since United beat Blackpool 2-1 on the same day to seal the 1955-56 championship and Mourinho said afterwards it would have felt “like death” for his team’s supporters. Instead, it was the players in red celebrating a highly memorable victory and City will have to wait until next weekend, at the earliest, to wrap up their third title in seven years.

More likely, it will need a little longer, given the chances of United losing at home to West Bromwich Albion.

An exhilarating high had turned into an excruciating low, and vice versa. “Wow”’ Guardiola said. “How could we lose that game?”