West Ham, coached by former City manager Manuel Pellegrini, frustrated the hosts for almost an hour at Etihad Stadium as the exertions of winning the English League Cup after extra time on Sunday perhaps took their toll.
But substitute Bernardo Silva reinvigorated the City attack after coming on as a substitute and the Portugal forward earned the penalty that Aguero tucked away for his league-leading 18th goal of the season.
City dominated the game — the team had more than 80 percent possession in the first half — but no goal came from its 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 then blocked another attempt from Mahrez.
City slowed as the first half wore on but continued to dominate possession and had another opportunity when Ilkay Gundogan blazed over. Samir Nasri, on his return to City, cut an isolated figure for West Ham 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 halftime and his replacement, Manuel Lanzini, looked far livelier, immediately creating a chance for Carroll that was kept out by City goalkeeper Ederson Moraes.
That prompted a response from City and manager Pep Guardiola withdrew the underwhelming Mahrez, with fellow winger Leroy Sane also making way. Their replacements, Raheem Sterling and Bernardo Silva, soon enlivened the game 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 goals 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.
More AP English soccer: https://apnews.com/PremierLeague and https://twitter.com/AP_Sports