The Hammers had only taken one point from their last six matches but showed great resolve to hand Chelsea their second successive Premier League defeat, with Aaron Cresswell scoring the only goal of the match.
West Ham boss Manuel Pellegrini opted to start with his third-choice goalkeeper David Martin rather than the error-prone Roberto, while Chelsea handed a first start since August to Olivier Giroud.
Pedro had an early shot blocked as Frank Lampard’s team made the better start to the match. At the other end, Michail Antonio volleyed a presentable chance over the bar.
Mason Mount’s shot from the edge of the area was blocked and Pedro just failed to latch on to Christian Pulisic’s cross as Chelsea continued to probe.
Reece James’ deflected shot hit the outside of the post and Kurt Zouma’s header flashed wide of the goal as the Hammers’ defence continued to live dangerously.
However, the visitors always looked dangerous on the break and Kepa Arrizabalaga was forced to make a good save to keep Antonio’s low header out as the first half ended goalless.
Pellegrini’s side stunned Chelsea when they took the lead three minutes after the restart, with Cresswell curling a superb right-footed effort past Kepa after good work by Felipe Anderson.
The home team never really recovered from the shock of falling behind and the Hammers almost doubled their lead on the hour mark when Antonio failed to force the ball home from virtually on the goal-line after Kepa had saved Fabian Balbuena’s header.
The visitors thought they had scored a second goal midway through the second half but Antonio was adjudged by VAR to have turned the ball home with his hand.
Callum Hudson-Odoi fired a shot over the bar but Chelsea never really looked like grabbing an equaliser as West Ham held on to clinch a surprise three points.