Ruben Dias and John Stones have been praised for their defensive work this season but came up trumps at the other end of the field to score for the hosts.
Their goals were sandwiched in between a Michail Antonio equaliser, which was not enough to prevent 20 straight victories for City, and here Sportsmail assess the performances of both sets of players at the Etihad Stadium.
Manchester City made it 20 straight victories with a hard-fought win against West Ham
Shaky early pass played Fernandinho into trouble but turned in a solid enough display without having lots to do.
Kyle Walker 6.5
Pace helped him out as West Ham threatened on the break, defended strongly but did not always use the ball well.
John Stones 9
Great shot for the second goal showed the confidence in his game and displayed good concentration against the Hammers’ dangerous counter.
Ruben Dias 8
First goal for the club was a brilliant piece of goal poaching and barely put a foot wrong at the other end of the field.
John Stones’ goal showed the confidence he has and he displayed good concentration too
Oleksandr Zinchenko 7
Pushed into the full-back turned central midfielder role that Cancelo has done so well and his passing was decent with a hand in the second goal.
Kevin De Bruyne 7.5
Looked a little rusty in the opening minutes but his delivery for Dias’s opening goal had to be seen to be believed.
Skipper played an important anchor role and made a number of key defensive contributions, one tackle on Lingard in particular.
Kevin De Bruyne’s delivery for Ruben Dias’s opening goal had to be seen to be believed
Ilkay Gündoğan 6
One of the players of the season but kept quiet by Moyes’ game plan and West Ham’s organisation gave him no freedom until late.
Riyad Mahrez 7
Couple of explosive flashes in the first half troubled Johnson and his contribution for City’s second was superb.
Sergio Aguero 5
First league start in four months and left on the edge of things. Caught in possession from the City throw that led to the Hammers equaliser.
Fernando Torres 5.5
Sloppy in his passing and didn’t track back for the West Ham leveller. Couldn’t unpick West Ham’s organised defence.
Sergio Aguero made his first league start in four months but was left on the edge of things
Gabriel Jesus for Aguero 60mins – 6
Phil Foden for Torres 65mins – 6
Rodri for Gundogan 89mins
Subs (not used) : Sterling, Steffen, Laporte, Rodri, Silva, Mendy, Cancelo.
Darren Randolph 6.5
Late injury to Fabianski meant second league game of the season but injured himself kicking in the second half. Had no chance with the goals.
Issa Diop 5.5
Caught back-pedalling to try and catch Dias for the opening goal, and missed a glorious injury-time header for a second equaliser.
Craig Dawson 6.5
The pick of the three centre halves with his reading of the game and tracking of City’s mobile front men.
Aaron Cresswell 6
Brilliant defensive header cleared a Zinchenko cross that looked certain to be put in and showed composure on the ball.
Issa Diop was caught out for Dias’ goal and missed a glorious injury-time header for the visitors
Vladimir Coufal 7
His attacking from the right wing-back position gave City a headache and led to the equaliser. Did well defensively against Torres too.
Tomas Soucek 6.5
Typical all-action performance and was alert to head a deflected Lingard chance towards Antonio for an early Hammers chance.
Declan Rice 7
Important component in the Hammers’ engine room with good passing and graft in front of his back four as they tried to stem the City tide.
Ben Johnson 5.5
Youngster showed inexperience against Mahrez and booked for a first half foul on him. Worked hard but beaten by Mahrez for the second.
Declan Rice (right) played and important part and showed good graft in front of his back four
Pablo Fornals 6.5
Required to do so much defensive work but was still busy and alert to play a role in the equaliser.
Jesse Lingard 8.5
His Hammers resurgence continued as the United loanee set up a great chance which Antonio struck against the post and an assist for the equaliser.
Michail Antonio 8
Target man had a key role to play as Hammers looked to relieve the pressure, hit the post and netted an equaliser.
Jesse Lingard’s Hammers resurgence continued as he assisted Michail Antonio’s equaliser
Said Benrahma for Antonio 84mins
Jarrod Bowen for Johnson 84mins
Subs (not used): Balbuena, Lanzini, Noble, Martin, Trott, Odubeko.
Referee: Michael Oliver 6