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.
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 men back into the relegation zone.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.