As a measure of what an unexpectedly difficult night this was for Manchester City, it was the first game all season they have failed to score two goals or more in the league at their own ground. No other side has managed that kind of record over a 15-game period in the top division since Tottenham in 1965 and, in the case of Pep Guardiola’s team, their previous assignment here was a 6-0 rampage against Chelsea.

At this stage of the season, however, they will not mind too much that their latest victory was a more prosaic affair featuring a penalty decision that must have hurt their opponents. On the balance of play, there could be no doubt City were the superior team, particularly when Bernardo Silva and Raheem Sterling added some much-needed impetus during the second half. All the same their former manager, Manuel Pellegrini, could conceivably have seen his current team emerge with a battling draw but for the contentious moment just before the hour mark when Silva went down under Felipe Anderson’s largely innocuous challenge and Sergio Agüero was handed the chance to continue his scoring run.

That was Agüero’s 25th goal of the season and, more importantly, it ensured City kept up the pressure on Liverpool at the top of the table. Yet it was a struggle at times for the reigning champions, epitomised by Guardiola replacing his leading scorer towards the end with a midfielder, Phil Foden, and the unusual sight of Kevin De Bruyne trying to waste a few seconds in stoppage time by running the ball towards the corner flag.

Quick Guide Premier League title race: the remaining fixtures Show Manchester City (86 points) 24 Apr Man Utd (a)

28 Apr Burnley (a)

4 May Leicester (h)

12 May Brighton (a) Liverpool (85 points) 21 Apr Cardiff (a)

26 Apr Huddersfield (h)

5 May Newcastle (a)

12 May Wolves (h)

As Pellegrini said afterwards of the penalty: “To be generous, it was a little soft. But that would be too generous. In the other box [the West Ham substitute] Manuel Lanzini had the same play but did not throw himself to the floor. If we lost this game from another action, we could accept it but it was not a penalty.”

A single-goal victory, settled by a moment of controversy, was certainly not what many City fans might have anticipated when, to put it into context, Guardiola had won all six of his previous encounters against these opponents, with an aggregate score of 22-3. On that basis West Ham ought to be reasonably encouraged, particularly as Marko Arnautovic was absent with a virus and Ben Johnson was making his first Premier League start. As the cousin of Ledley King and nephew of Paul Parker, Johnson, a 19-year-old full-back, comes from a family that clearly places great importance on the art of defence, and that was probably just as well given the amount of time West Ham had to spend in retreat.

Bernardo Silva goes down under the challenge of Felipe Anderson. Photograph: Oli Scarff/AFP/Getty Images

Not that City had it all their own way. Guardiola’s body language was telling at times, staring out anxiously from the dugout or moving to the edge of the pitch, arms folded or hands shoved into his pockets. He claimed afterwards he was “delighted” that his team had played “so good.” During the game, however, he looked dissatisfied and at times the crowd sounded it, too, particularly when Riyad Mahrez was straying offside or misplacing passes. This was Mahrez’s first start in a league match since 30 December and, though Sterling and Silva were entitled to a rest, it was not a good night for the club’s record signing, looking conspicuously low on confidence and substituted early in the second half.

The same could be said for Samir Nasri, who was barely involved for West Ham on the night he returned to face his former club. Pellegrini replaced him with Lanzini at the break and, five minutes after the restart, the substitute set up Andy Carroll for West Ham’s first chance of the night. It was a splendid chance, too – by far the clearest opportunity until that stage. Carroll was at full stretch when he connected with Lanzini’s cross but Ederson’s flying save spared City from going behind.

For West Ham it was a costly save. Silva, a 58th-minute replacement for Leroy Sané, had been on the pitch only a minute when he tried to get past Anderson in the penalty area. Declan Rice, who was being watched by the England manager, Gareth Southgate, was also tracking the City player and it was a questionable decision from the referee, Stuart Attwell.

Silva appeared to stumble rather than actually being fouled, and the sight of him punching the air at the award of the penalty will not have lessened West Ham’s feelings of injustice. Agüero put the penalty to the left of Lukasz Fabianski and, after that, West Ham were indebted to their goalkeeper, particularly for a one-handed save from Sterling that prevented it becoming the kind of scoreline to which City are accustomed at their own ground.