Manchester City needed a second-half Sergio Aguero penalty to see off West Ham and stay one point behind leaders Liverpool at the top of the Premier League.
The defending champions had to wait for the Argentina striker’s 59th-minute spot-kick to break down the well-organised Hammers, but ultimately it was enough to secure a vital victory.
City, who are still chasing glory on three fronts after winning the Carabao Cup on Sunday, showed off that trophy before kick-off and tore into the visitors in the opening minutes.
But the closest they came to an early goal was when David Silva turned Kevin de Bruyne’s cross on to a post and West Ham soon began to frustrate them.
The Hammers did not threaten at all at the other end until Andy Carroll brought a fine save from Ederson with their first shot of the game at the start of the second half.
However, they succeeded in keeping City quiet and, with Liverpool on their way to a 5-0 win over Watford, the home fans’ frustration began to show.
City were utterly dominant on the ball with more than 80% of possession but they needed the introduction of Raheem Sterling and Bernardo Silva off the bench to provide the spark they needed in attack.
Silva took a matter of minutes to make an impact, cutting into the box from the right and going down under pressure from Felipe Anderson, to prompt referee Stuart Atwell to point to the spot.
Aguero made no mistake, sending Lukasz Fabianski the wrong way for his 25th goal of the season
More City chances followed, with Ryan Fredericks clearing off the line from Silva and Sterling missing the target from close range, but in the end one goal was sufficient.
“Many things are going to happen,” manager Pep Guardiola said. “I think we are going to drop points and Liverpool are going to drop points so we are going to see, until the end.”
With City having lost just one of their past 15 games before taking on West Ham, it is clear there is not much wrong with Guardiola’s side at the moment and they coped well enough without the injured Fernandinho here.
One area for concern is the form of Riyad Mahrez, who became City’s £60m record signing when he joined from Leicester last summer.
The Algerian has not had many opportunities recently – this was his first Premier League start of the year – but he did not take his chance to impress Guardiola.
Despite being up against a teenage debutant, Ben Johnson, Mahrez struggled to impose himself on the right flank and his final ball, whether a pass or a shot, was frequently disappointing.
It was no surprise when he was replaced by Sterling just 10 minutes into the second half.
Another substitute, Bernardo Silva, replaced Leroy Sane and took Mahrez’s place on the right soon afterwards and the pair added much-needed energy to City’s flanks, with Silva quickly winning the penalty that Aguero scored.
“Bernardo is a master – an incredible player at reading that situation,” said Guardiola.
“Riyad played good – he took some risks and unfortunately he hit the first player often. Normally he is so clinical, such a good player at finishing in the first action with the right foot, but of course sometimes you need time to connect between the players and that is going to happen.”
Manuel Pellegrini’s City sides were known for their attacking verve but the Chilean demonstrated defensive diligence on his first return to his old club.
The Hammers boss, who took City to the title in 2014, waved to the home fans when they chanted his name in the opening minutes but it was soon clear that he had a plan to frustrate them.
With Pedro Obiang and Declan Rice protecting a solid back four, they sat in their own half and gave City little space to operate in.
When the ball did come near the Hammers area, Issa Diop and Angelo Ogbonna were in the right place to deal with it and of City’s 11 shots in the first half, only one was on target.
It took a debatable penalty to end their resistance and, although West Ham are now winless in their past six league and cup games on the road, this was a defensive performance that will offer Pellegrini plenty of encouragement.
“To be generous, it was a little soft, but that is too generous – it was not a penalty,” said Pellegrini.
“It was a play that happens a lot of times inside the box – in the other box Manuel Lanzini had exactly the same play and he did not fall to the floor.
“So if we lose this game with another action maybe you can accept it, but not that penalty.”