West Ham pulled one back through Manuel Lanzini in stoppage time but it would prove no more than a consolation.
The match was characterised by snowfall throughout the first half and the interval had to be extended while the pitch was cleared.
Aymeric Laporte and Riyad Mahrez also hit the woodwork for City, who controlled the game for long spells, but West Ham proved difficult to kill off.
In the end, substitute Fernandinho’s last-minute strike brought much relief after Declan Rice had threatened to snatch a stunning equaliser moments earlier.
The Hammers had also started well against a City side again lacking the creativity of Kevin De Bruyne, Jack Grealish and Phil Foden.
Michail Antonio got behind the defence and almost teed up Said Benrahma but the Algerian got the ball caught under his feet.
Benrahma later caught another effort from outside the area cleaner but Ederson was equal to his powerful drive.
City’s best opportunity of the opening stages came from a corner but it almost yielded a goal as Laporte’s glancing header shaved the woodwork.
Mahrez thought he had opened the scoring soon after when he rifled in following a Raheem Sterling chargedown but he was ruled offside.
West Ham threatened again when Antonio was fouled just outside the area by Laporte, who was booked and now faces suspension.
Aaron Cresswell fired in the resulting free-kick from the right but it was deflected into the side-netting.
City claimed the lead just after the hour as Mahrez received a crossfield ball and played into the box. A fortunate deflection diverted it into the path of Gundogan and the German was presented with a simple close-range finish.
City went close to another before the break as Joao Cancelo forced a fine save from Lukasz Fabianski from distance and Mahrez slammed the rebound against the post.
By then snow was falling heavily and settling on the pitch. With visibility limited and line markings being obscured, conditions were almost becoming unplayable.
Indeed, had half-time not been approaching, play might have been halted. As it happened, referee Michael Oliver allowed the game to go on until the natural break at 45 minutes, when groundstaff were quickly into action to clear the pitch.
The restart had to be delayed as all the snow was removed but, with the weather relenting, their operation was successful and they received a round of applause.
City had a big chance when play resumed as Sterling broke clear to set up Gabriel Jesus but the Brazilian was twice denied, first by Fabianski and then by a brave goalline clearance from Cresswell.
Cresswell collided with the goalpost as he stretched to make his interception and, after several minutes of treatment and a brief attempt to play on, was forced off.
As time wore on, West Ham began to sense an opportunity to grab a draw but Ederson produced a superb save to keep out Rice’s long-range effort.
Fernandinho eased City’s nerves in the final minute before Lanzini netted with almost the final kick of the game.
Register for free to continue reading
Registration is a free and easy way to support our truly independent journalism
By registering, you will also enjoy limited access to Premium articles, exclusive newsletters, commenting, and virtual events with our leading journalists
Already have an account? sign in