David Silva delivered the customary Manchester City late show with a deft volley to clinch three points from a battling West Ham at the Etihad.
Angelo Ogbonna gave the Hammers a shock lead on the stroke of half-time, rising above Otamendi to head Aaron Cresswell's cross beyond keeper Ederson.
Despite City dominating possession, it took until just before the hour mark for Otamendi to made amends with a close-range finish his side's strikers would have been proud of from a Gabriel Jesus ball.
But as has become habit for the Premier League's runaway leaders a late winner was only a matter of time.
And this time it fell for Silva in the 83rd minute courtesy of a brilliant lofted cross from Kevin de Bruyne.
City are now eight points ahead of Manchester United in second.
Here is how Andy Dunn rated the players' performances.
MANCHESTER CITY
Ederson 6
Got a hand to the Ogbonna header but not to blame, otherwise fairly redundant
Walker 6
Only required as an attacking force and sent over a couple of decent crosses
Otamendi 6
Outjumped for West Ham goal, proving a bit more useful in attack rather than defence
Mangala 5
Not overly exerted but looked vulnerable on the rare occasions he was called on to defend
Danilo 5
Struggled from the off, never got into any sort of rhythm, no surprise he was hooked at half-time
Delph 6
Had a forgettable half as the midfield pivot, better when switched to left-back for second half
De Bruyne 6
Booked. Rare day of frustration until he came up with a lovely, floated assist
D Silva 8 -MOTM
Freakishly misplaced one or two passes but atoned with a priceless winner
Sterling 7
Ran into a lot of cul-de-sacs but still provided a real threat with every scamper
Aguero 6
Struggled and never really looked like sneaking his way through a congested defence
Sane 6
All a bit casual and caught on his heels on defensive duty when City conceded
SUBS
Jesus (Danilo 46 mins) 6
Fernandinho (Aguero 85 mins)
B Silva (Sane 91mins)
WEST HAM
Adrian 6
Booked. A coupe of saves were strictly for the cameras but did enough to give Joe Hart a worry or two
Zabaleta 6
Appeared to be targeted by City but rolled back the years with a dogged display
Rice 5
Booked. Conceded a costly free-kick ahead of the equaliser but battled manfully
Ogbonna 7
Towering header for his first league goal and played his part in a huge defensive effort
Cresswell 6
His delivery was always going to be an asset and produced the perfect cross at the right time
Masuaku 6
Quick feet, strong and a trick or three, the type of player who would probably interest Pep
Obiang 6
Hardly foot-perfect but set a very good example with his tireless industry
Fernandes 5
A rangy presence in midfield, made one or two very crucial interventions
Kouyate 6
Tried to carry on after suffering what looks like a hamstring problem but succumbed eventually
Lanzini 6
Tidy but took an accidental knee in the back from Mangala and had to make way
Antonio 6
Tried to drive his side forward on the odd occasion and did his defensive share
SUBS
Sakho (Kouyate 43 mins) 6
Arnautovic (Lanzini 69 mins) 6