Morgan Amalfitano opened the scoring after great work from Enner Valencia down the right flank, as the Hammers dominated the first half.
City came out with added impetus after the break, and were twice denied by the woodwork in their quest to level proceedings.
However, the in-form Diafra Sakho headed his sixth successive goal for the Hammers – becoming the first player to record such a feat in the club’s history, to double his side’s lead.
David Silva immediately got City back in the game with a sublime individual effort, and ensured a nervy final 10 minutes were in store for the home fans.
However, Adrian and his defence stood firm and Sam Allardyce’s team continued their fantastic start to the season.
The result sees West Ham stay fourth, while City will be hoping for a favour from bitter rivals Manchester United on Sunday to ensure they don’t fall too far behind leaders Chelsea in their title defence.
City had plenty of early possession, but it was the visitors who looked more threatening from the word go.
A West Ham free-kick almost led to the opening goal. James Collins lumped it forward and Sakho flicked it onto Valencia, but Hart saved from close range. The goalkeeper was clattered by Valencia and looked to be in trouble, but he managed to shake it off and carry on.
Valencia was causing City all sorts of problems with his pace and power, and the Ecuadorian was key to earning the Hammers the lead.
Latching onto a fantastic throughball from Alex Song, Valencia drove at Clichy, got to the byline, and pulled the ball across goal, just evading the outstretched leg of Pablo Zabaleta, and straight into the path of Amalfitano, who couldn’t miss from one yard out.
The hosts were certainly buoyed by their goal, and they almost doubled their lead just a few minutes later, but Stewart Downing headed over when he really should have hit the target after arriving late in the box.
Valencia was in the thick of the action again as the home side continued to dominate. The lively forward got on the end of an Aaron Cresswell cutback, but he scuffed his shot just wide.
City rarely threatened, but almost got an undeserved equaliser late in the opening period, but Adrian was alert to use his feet to clear from under Sergio Aguero’s nose as the Argentinian striker tried to control a low, fizzing cross.
The second-half began as the first ended – with the home side in the ascendancy.
Downing wasted a glorious chance to extend the lead early in the half, after being picked out by some audacious skill from Song, but the former Liverpool midfielder dragged his effort wide on the volley.
Aguero almost levelled just before the hour mark after being played in by David Silva, but City’s talisman was denied by the feet of Adrian, and a wonderful James Collins block on the rebound.
Then the Argentinian hitman had the best chance of the match, and a man of his ability should really have equalised.
After being picked out, in space, three yards out, Aguero somehow contrived to hit the underside of the crossbar, with the rebound falling to Yaya Toure, but Adrian was equal to it, making an acrobatic block, even keeping hold of the ball.
City enjoyed a period of dominance following that chance, but they couldn’t find a way through a resolute Hammers rear guard.
Toure was then guilty of missing another great chance to get back on level terms, but his curling effort from the edge of the box clipped the top of the crossbar.
The hosts made City pay for missing those opportunities just minutes later, with Sakho once again getting on the scoresheet.
A wonderful left-wing cross from the impressive Cresswell picked out the in-form Senegalese hitman, who headed towards the bottom corner, which Joe Hart reached to try to keep out, but the goal decision system revealed it had crossed the line.
City got back into it almost immediately, however, thanks to a wonderful individual goal from David Silva.
The Spanish midfielder jinked his way through several tackles, and curled a sublime effort past Adrian to give the visitors hope.
It ensured the final 10 minutes were nervy for the Upton Park faithful, but some last ditch defending kept the champions at bay, and ensured the Hammers’ impressive start to the season continues.