Angelo Ogbonna gave the away side a shock lead before half-time, but goals after the interval from Nicolás Otamendi and stand-in captain David Silva were enough to give Pep Guardiola's team victory.
It was yet another late goal for the league leaders, after similarly tardy strikes against Huddersfield Town and Southampton in recent games.
They have only dropped two points all season and try as hard as many other sides may, it's hard to see anyone stopping them winning the title.
City have now won 20 in a row in all competitions, which is a club record, and if they beat Manchester United in the derby next weekend, they'll set a Premier League record of 14 consecutive victories too.
The match against West Ham, who are yet to win under David Moyes, was meant to be a walk in the park, but it wasn't easy at all.
The Hammers boss will definitely take some positives from this performance as he looks to turn around their season and keep them in the Premier League.
But what did we learn from the match? Here are our five tactical takeaways.
Danilo needs to step it up
When Danilo was named in the team it was a bit of a surprise, as Fabian Delph had been preferred at left-back this season.
He wasn’t particularly bad, but he wasn’t particularly good either, and it feels like it’s the Englishman who Guardiola prefers.
The Brazilian was hauled off at half-time as the Catalan coach tried to break down West Ham.
His first half saw him attempt one dribble, without success, and make more passes than any other defender before half-time, 44. He had an 86 per cent pass success.
He was solid, but unspectacular, and occasionally made the wrong decision, as could be seen when he just floated a ball straight at Adrián in the first half, rather than having a proper shot or picking Kevin De Bruyne out.
If he wants to become a regular, he’ll need to step it up.
Delph is key to Pep’s plans
At the start of the season, it may have seemed strange to say Delph would have been a key part of a Manchester City team that is on the verge of something very special indeed.
Yet with Benjamin Mendy’s injury, he’s established himself as a left-back, but with Fernandinho one yellow card away from picking up a suspension, he was put on the bench ahead of next weekend’s derby against Manchester United.
Before the match, John Stones was speaking to Sky about how Guardiola liked them to try and outnumber the opposition in certain areas of the pitch, but he said they would always try and make sure Fernandinho was free as he was such a key player for them.
The Brazilian has averaged 90.8 passes per 90 minutes so far this season, with only Otamendi making more for City out of the players who are regular starters.
And his absence led to Delph changing positions from left-back, where he’s been regularly playing, to the Fernandinho role in the team, with Danilo coming into the back four to replace him.
Playing in that role, he made the most interceptions out of any one on the pitch in the first-half, three.
The 28-year-old also made more passes than anyone else (57), and had the second best passing accuracy, with only Eliaquim Mangala’s 93 per cent bettering his 91 per cent.
Compared to his fellow midfielders De Bruyne and Silva, he did make fewer key passes in that role though, one rather than the two each of them made.
It was fair to say they were still using him like they would use Fernandinho though, and should the Brazilian miss more games, he will probably come back into that role again, even if he did return to left-back in the second-half as City changed formation.
And it was him coming forward from that position that played a role in the equaliser, winning a free-kick which Adrián palmed away, before it was returned into the box for Otamendi to score.
Five at the back may be the best solution for West Ham’s defence
West Ham went into the game with absolutely no form, while City had won 12 in a row in the league. The question was how would they stop them, and David Moyes himself seemed unsure before the game.
He decided five at the back was the way forward, hoping to create a barrier they couldn’t break down.
They weren’t even that keen on pressing, just trying to stick as one line.
Up front, it was reliant on Michail Antonio, and then Diafra Sakho, leading the line, hoping for a moment of magic from Manuel Lanzini to break them down.
They weren’t even that keen on closing them down, just trying to stick as one line.
But with City’s lethargy in the first half, that worked. Perhaps with a bit of luck, when City play 4-3-3, that could be the way to stop them.
And for Moyes, it may be the way forward. No-one has conceded more goals than West Ham and sorting out the defence needs to be a priority. Keeping out the league’s top scorers for a half, especially with the likes of José Fonte and Winston Reid injured, shows it can work.
They need to stop conceding, as more often than not, the team that lets the most goals in the Premier League is relegated, so becoming solid at the back has to be a priority.
4-3-3 isn’t the only solution for Manchester City
Guardiola is known for being flexible, but for most of this season, he’s lined up his City side in a 4-3-3, and they’ve destroyed pretty much everything that’s come in front of them.
After a lacklustre first half, he switched shape, moving Delph to left-back and bringing on Gabriel Jesus, in what became a 4-2-4, to properly drive at West Ham’s back five.
And that’s what the fear is for teams, as the Catalan coach counters the threat posed by the opposition.
Switching to the four attackers meant the Hammers were unsure what to do.
They couldn’t work out whether to follow the man as they moved around, or try and stay deep still.
It led to more gaps in the defence and just underlined how difficult it is to stop this City side, as they got the equaliser through Jesus making the most of getting free and playing the ball across to Otamendi.
If the team against City were a team with more up front, they could have properly tested the hosts with an attacking threat, but West Ham didn’t really have that from open play.
The home side threw everything forward, with 82.8 per cent possession between half time and Silva’s winner.
City may have had 71.2 per cent possession in the first half, but the switch made them so much more attacking and made it impossible for the Hammers to keep them out twice.
Those subtle changes will worry a number of opposition managers as they look to try and find a way to stop the team that already look like champions.
Defending corners is City’s Achilles heel
The question before the game was whether there was a weakness in this City team, with their defence hugely improved from last season.
Early on, it looked like West Ham decided their best way of scoring was from a set piece, with Huddersfield scoring from a corner when they faced Guardiola’s side last weekend.
That goal came from a near-post flick-on, and within eight minutes, the Hammers almost replicated the feat, with Cheikhou Kouyaté heading it on to the back post.
Antonio was there but at full stretch, he couldn’t quite get enough on it to put the ball into the back of the net.
Their second corner was also aimed at the near post, but their third was a slight change of routine which really caught City out.
Aaron Cresswell played it short to Lanzini, who played it back to him, with the Englishman crossing it in, Ogbonna rose highest and Ederson wasn’t quite able to claw it out to give the away side a shock lead.
There’s no doubt that José Mourinho will have been watching this and thinking that is how he can target his Manchester rivals next week.
Manchester United are undoubtedly a much more physical team than City, so expect them to be playing for a lot of set pieces next Sunday.