Frank Lampard fired Chelsea ahead in the first-half before Marlon Harewood equalized one minute after re-start.
Hernan Crespo and Didier Drogba scored in the 60th and 80th minutes respectively to secure the three points for the Blues.
The win maintained Chelsea's position at the summit of the Premier League table with 58 points while West Ham left tenth on 26 points.
Lampard broke the deadlock in the 25th minute when he sent a powerful first-time volley past West Ham keeper Roy Carroll.
Only 20 seconds after re-start, Harewood picked up a Nigel Reo-Coker pass before firing into Petr Cech's body.
The Czech guardian fumbled the ball allowing the West Ham striker to poke home the equalizer.
Substitute Crespo restored the lead for the visitors immediately after coming on to the pitch when he received Arjen Robben's through pass and rounded Carroll before shooting into the empty net.
Ivory Coast international Drogba secured the win for Chelsea with a powerful drive that settled in the bottom corner of the net with 10 minutes left to play.
Earlier, Aston Villa snatched a hard fought 2-1 victory over West Bromwich Albion.
Steve Watson's goal in the 76th minute for West Bromwich cancelled out Steven Davis' opener in the 47th minute before Milan Baros sealed the victory ten minutes from time.