On his 595th Chelsea appearance, Lampard headed in an Eden Hazard cross after 19 minutes to move within two of Bobby Tambling's club scoring record of 202 goals.
Former West Ham striker Demba Ba should have scored three times in the first half, but Chelsea went two goals ahead when the impressive Hazard netted after 50 minutes.
Lampard was unmarked when he met Hazard's clipped cross from the right channel with a firm header for his first goal since his strike in the FA Cup fourth-round replay with Brentford.
He celebrated his 12th league goal of the season in front of the away end and with John Terry, who was selected on the bench, and the visiting support expressed their displeasure by hurling objects the duo's way.
In the first half West Ham rarely threatened - Andy Carroll had a strike chalked off for a push in the back on David Luiz - and the Blues should have been out of sight by the interval.
Jussi Jaaskelainen saved a low Luiz free-kick and twice denied Ba when the striker had been found by Victor Moses, who also shot wide on the turn from Cesar Azpilicueta's cross as West Ham again left a Chelsea player in space in the box.
Juan Mata curled off target, a spectacular Luiz left-footed volley went narrowly wide and Chelsea's dominance continued after the break.
Hazard collected an attacking throw-in down the right, linked with Mata and then was allowed to drift across the area. The Belgian went past a hapless Winston Reid and James Collins before shooting left-footed and low into the bottom corner.
Hammers substitute Carlton Cole got in front of Gary Cahill at the near post but Petr Cech saved and Carroll headed over from a late corner for the Hammers, who were then fortunate not to concede a third goal. Uncharacteristically Lampard ballooned a shot over from Oscar's cross after 86 minutes before soaking up the acclaim at the final whistle.
Source: PA
Source: PA