Andy Carroll squandered a glorious chance to decorate his Upton Park return with a crucial goal as Newcastle ended their three-match losing run in the Barclays Premier League.
Carroll, back from a long-term foot injury, made his second appearance of the season as a 62nd-minute substitute and was guilty of an awful miss.
With West Ham trailing 2-1 and the match finely poised, the England striker had the goal at his mercy after being teed up by Stewart Downing only to loft his attempt high over the crossbar.
Strikes from Yohan Cabaye and Loic Remy put impressive Newcastle in a commanding position, but Mike Williamson's own goal in first-half injury time set up a more competitive second half.
West Ham, buoyed by the arrival of Ravel Morrison, displayed greater fight and Carlton Cole should have scored the equaliser but also butchered the simplest of chances.
Newcastle added their third four minutes into injury time when Cabaye curled a free-kick around the wall, off the left post and into the net.
The result means West Ham slip back into the relegation zone while Newcastle have concluded their four-match losing run in all competitions.
The Magpies in full flow were great to watch but they will face few more accommodating back fours than Razvan Rat, James Collins, Roger Johnson and Matt Taylor.
Cabaye and Remy benefited from some woeful defending and had the Magpies been just a little more clinical, the contest would have been over by half-time.
Injury-hit West Ham's shortcomings in defence were exposed in the opening minutes when Cabaye threaded a terrific pass to Remy.
The Frenchman outfoxed Johnson and Collins and having created enough room to take a shot, sent the ball narrowly wide of the left post.
When Cabaye was given the opportunity to put Newcastle ahead in the 16th minute, he seized his chance.
Yoan Gouffran darted infield and found Cabaye, who took two touches and passed the ball into the net with West Ham's passive defence all but waving him through.
It was turning into the Cabaye show as the French midfielder set up Moussa Sissoko with a long pass, which should have been buried, before shooting just wide himself.
The half-hour mark saw West Ham's first chance, but Downing stabbed the ball straight into the arms of Tim Krul.
Any hope that Downing's attempt might inspire the Hammers faded almost immediately as Newcastle capitalised on more shambolic defending to surge 2-0 ahead.
Sissoko floated in a cross that should have been cleared with ease, but instead Remy was able to glide unmarked into the six-yard box and stab home.
Remarkably given the run of play, West Ham pulled one back deep into first-half injury time and this time Newcastle's defence was at fault.
Rat provided the cross to Cole, who chested the ball down and muscled his way through two defenders, Williamson adjudged to have got the final touch as the ball found its way past Krul.
The goal seemed only to be a momentary lapse in concentration as Cabaye tested Adrian early in the second half, but slowly West Ham began to display some stomach for the fight.
A hint of complacency had crept into Newcastle's play and it was now the Hammers who were driving forward.
Cole should have rounded off Matt Taylor's hard work by dispatching the equaliser but instead he blundered over a simple chance, steering the ball wide with the target at his mercy.
Carroll's first appearance of the season at Upton Park was greeted by a loud cheer, but when the stage beckoned for the England forward to deliver he skied the ball into the stands.
Fittingly, it was the brilliant Cabaye who supplied Newcastle's third goal in the 95th minute.