An own goal before the break gave the hosts hope as the Magpies ended a run of three Premier League defeats leaving the Hammers in desperate trouble in the bottom three
The visitors had lost their last three in the top flight and had not beaten West Ham in three attempts but went ahead through Yohan Cabaye after 15 minutes, registering Newcastle's first Premier League goal of 2014 with a cool finish from inside the area.
Loic Remy ended his own four-game barren run just past the half-hour mark, putting Alan Pardew's side firmly in control with a close-range effort.
Despite being on the back foot for much of the half, West Ham went in only a goal behind after Carlton Cole's shot was parried by Tim Krul and deflected in by Mike Williamson.
|VIEW FROM UPTON PARK
|By Ewan Roberts
Newcastle have ended their winless, and goalless, run in fine fashion. Alan Pardew's men raced into the lead at Upton Park, but were forced to dig in and hold on in the second half after a Mike Williamson own goal had given the home side a lifeline.
Yohan Cabaye was unquestionably the star of the show, opening the scoring with a measured finish before curling a stunning free kick beyond Adrian in injury time to guarantee all three points. The Frenchman totally controlled proceedings.
For West Ham, who were booed off at the end of the match, it is hard to see how they can arrest their worrying form. Today's other results have seen the side slide back into the bottom three, and Andy Carroll's return will not make the defence any less porous or the midfield any more dominant.
Sam Allardyce, still yet to record back-to-back Premier League wins as West Ham manager, has plenty to ponder, though there is a sense that he can still be the right man to keep this Hammers side, designed in his image, in the top flight.
Cabaye completed his brace and wrapped up the points in the 95th minute after the hosts had failed to make their lengthy spells of pressure count in the second half.
Sam Allardyce made two enforced changes to his side, with James Collins and Mohamed Diame coming in for the injured Guy Demel and suspended James Tomkins.
Captain Kevin Nolan served the final game of a four-match suspension, while his former side Newcastle were unchanged from Sunday's defeat to Manchester City.
The hosts began the brighter, buoyed by a first league win since November last time out against Cardiff City, and could have been awarded a penalty after four minutes - Steven Taylor appearing to bundle Diame over in the area.
Remy had Newcastle's first opportunity, cutting inside Matt Taylor and hitting a timid effort wide following a lofted ball from Cabaye after eight minutes.
Cabaye handed his side the lead soon after, taking Yoan Gouffran's ball in his stride and past Razvan Rat before steering beyond Adrian with his right foot.
Mark Noble was called on to clear Gouffran's weak effort off the line four minutes later, before Moussa Sissoko shot straight at Adrian when through on goal as the visitors enjoyed a strong spell of pressure.
Their dominance paid off after 33 minutes when Remy took Sissoko's cross on his chest and nudged the ball past Adrian to put Newcastle two goals ahead.
Williamson's own goal gave Allardyce's side hope in injury time at the end of the first half, with Cole's saved effort ricocheting off the defender and rolling in.
Cole should have had a goal of his own 10 minutes into the second half, but could only divert Rat's delivery past Krul's far post as the hosts began well after the interval.
Allardyce, who brought on Ravel Morrison at the break, introduced former Newcastle striker Andy Carroll soon after the hour mark, and the England international was denied a leveller by Mapou Yanga-Mbiwa's well-timed clearance from Stewart Downing's dangerous cross.
Carroll blazed over from inside the area with 15 minutes remaining as West Ham pushed for a second before Cabaye got rid of any Newcastle nerves, curling in a free kick off the post from outside the area to send the home side back into the relegation zone.