The defending champion made light of the difficult wintry conditions at the Etihad Stadium, where the visitor has now won just once in 16 top-flight visits.
Gundogan was on target in a first half where Riyad Mahrez had a strike ruled out, while the Hammers – who have now suffered back-to-back league defeats – were put to rest when Fernandinho netted late on with Manuel Lanzini's goal proving a mere consolation.
Pep Guardiola's 10th top-flight win in 11 attempts against West Ham means City closed the gap on Chelsea to one point after the Blues were held to a 1-1 draw against Manchester United.
Aymeric Laporte headed onto the right-hand post in the opening stages before Mahrez was adjudged to be offside from Raheem Sterling's pass after he had powered past Lukasz Fabianski.
City broke the deadlock when Gundogan bundled Mahrez's low cross home, with Ben Johnson then required to clear Gabriel Jesus' effort off the line and Mahrez cannoning against the woodwork in a flurry of first-half chances.
The host almost doubled its lead after the interval through Jesus, who saw another chipped attempt cleared off the line by Aaron Cresswell, while Sterling blasted wildly over after the hour mark.
Jesus then teed up Fernandinho to slot into the bottom-left corner to make sure of the result with Bernardo Silva seeing another ruled out prior to Lanzini curling perfectly past Ederson to at least half the arrears for West Ham.