Sergio Aguero's second-half penalty kept Manchester City within a point of Premier League leaders Liverpool as the champions clinched a hard-fought 1-0 win over West Ham.
The Hammers, under the charge of former City manager Manuel Pellegrini, frustrated the hosts for an hour at the Etihad Stadium as the exertions of winning the Carabao Cup at the weekend perhaps took their toll.
But substitute Bernardo Silva reinvigorated the City attack and the Portuguese earned the spot-kick from which the prolific Aguero made no mistake, tucking home his 25th goal of the season.
City deserved their victory having dominated the game and created numerous chances but Pellegrini, who won the title with City in 2014, will be disappointed his side's dogged defending was not rewarded.
City played well in patches, their first hot spell coming in a whirlwind start.
Kevin De Bruyne fired narrowly wide in the first minute and Riyad Mahrez volleyed over. David Silva then hit a post at the end of a slick move involving De Bruyne, who then sent another effort off-target. Angelo Ogbonna blocked then another attempt from Mahrez.
City slowed as the first half wore on but they continued to dominate possession and had another opportunity when Ilkay Gundogan blazed over.
The Hammers struggled to get into the game and Samir Nasri, on his return to City, cut an isolated figure playing behind lone striker Andy Carroll, who was making his first appearance in five games.
But still, with Mahrez firing another shot at Lukasz Fabianski, the visitors did enough to reach the break with the score still 0-0.
Nasri was withdrawn at the interval and his replacement Manuel Lanzini, looking far livelier, immediately created a chance for Carroll, who was denied by Ederson.
That prompted a response from City and manager Pep Guardiola withdrew the underwhelming Mahrez and Leroy Sane also made way.
Their replacements Raheem Sterling and Bernardo Silva soon enlivened the attack and the latter earned City's breakthrough as he was clipped by Felipe Anderson on a run into the box. Aguero sent Fabianski the wrong the way from the spot.
City pressed for more with Sterling forcing a save from Fabianski and David Silva's follow-up effort cleared off the line by Ryan Fredericks. Sterling then tested Fabianski with another effort from distance and Danilo shot at the keeper from distance.
West Ham offered little although a dipping shot from Fredericks did drop just over the bar eight minutes from time.
City, who earlier in the day announced they will play sister club Yokohama F Marinos in a pre-season friendly in Japan on July 27, had little trouble seeing out the closing stages despite looking weary.