For Sergio Agüero, it was a bittersweet evening. The most important detail is that his team won and have put themselves in a position of strength in their qualifying group. Yet this was also a night when Agüero missed the opportunity to sugarcoat a slightly dishevelled performance with the goal that would have established him as Manchester City’s joint all-time record scorer.

The damage is only superficial and Agüero’s time to equal Eric Brook’s 177‑goal target, a record that has stood since 1939, will inevitably come, perhaps even against Chelsea on Saturday. Yet City will have to hope that his inability to finish off a 71st-minute penalty is not a sign of the anxiety that sometimes grips a player when they are on the cusp of these personal milestones.

As brilliant as he is, Agüero’s record from the penalty spot jars with the rest of his scoring achievements. This one was saved by Andriy Pyatov and City will just be glad that Shakhtar Donetsk, the better side in the opening half, ran out of puff after that point, with an assortment of visiting players needing treatment for cramp.

Instead, the game was settled by the late goal from Raheem Sterling, a substitute, to add to the latest piece of brilliance in Kevin De Bruyne’s portfolio. Agüero looked forlorn when he was substituted late on, with his penalty rather uncharitably being replayed on the giant screen, but it ended up being a splendid result for City.

Donetsk were a fine team and ought to have been awarded a penalty for John Stones’s handball before Sterling soothed the crowd’s nerves, just as the fourth official was about to hold up the electronic board announcing four minutes of stoppage time.

As is his way, Sterling had already missed an even more glaring chance and, overall, City created enough opportunities in the second half to feel like they warranted the victory, their seventh on the bounce in all competitions. Yet it was a difficult night at times and Guardiola must have been startled by the way City’s opponents controlled the opening 45 minutes. It is not often that a team visit this stadium and attempt to outpass the home team but Donetsk’s Brazilian contingent, with four of their front five originating from South America, elegantly set about the first half.

Raheem Sterling scores in injury time to seal victory for the home side. Photograph: Oldham/BPI/Rex/Shutterstock

Guardiola has never been very good at hiding his displeasure and the City manager looked slightly nonplussed during those moments, running his fingers down his face as if bewildered by what he was seeing.

That does not mean City were playing badly, more that their opponents were operating at a level to cause anxiety. Taison, Fred, Bernard and Marlos all showed the familiar Brazilian traits of quick, incisive, soft-touch football. Ismaily, the team’s left-back, was another who caught the eye. Guardiola described the Ukrainian champions afterwards as a “machine” and an “amazing team” and there was a measure of relief to his post‑match comments.

“I said to the players: ‘You have to be proud because you have beaten one of the best teams at the way they play,’” the City manager said.

The game swung in City’s favour three minutes after the restart and here was another demonstration of De Bruyne’s brilliance, even on a night when the Belgian did not always exert his usual influence. Marlos was the Donetsk player who put his team in trouble with a loose pass. De Bruyne intercepted the ball and David Silva carried the possession on before squaring the ball back to his team‑mate. De Bruyne was just over 20 yards out, in a central position, and whipped a curling, powerfully struck shot into the top right-hand corner of Pyatov’s goal.

As well as his penalty, Agüero might also reflect on the moment 10 minutes into the second half when Silva clipped a lovely ball over the top for the Argentinian. Agüero struck his volleyed shot well enough but it went straight at Pyatov and, that apart, most of City’s chances fell to their midfielders.

Leroy Sané’s penetrative running was another feature, leading to Ivan Ordets clipping the German to give away the penalty, and Silva grew into the game after a strangely subdued start.

Fabian Delph’s performance as an experimental left-back must also have encouraged Guardiola – “exceptional” was the word City’s manager applied – at a time when Benjamin Mendy is facing a long lay-off because of the knee injury he sustained in the 5-0 win against Crystal Palace on Saturday.

Mendy watched this match on crutches, with his knee in a protective brace, and is to fly to Barcelona to ascertain whether he has ligament damage. Guardiola’s assessment was that he did not expect good news, acknowledging that the £50m signing would be missing for a number of months.