Joselu marked his first start for Newcastle with a goal as Rafael Benitez was finally able to celebrate a first win of the season.
The Spanish striker converted Christian Atsu's 36th-minute cross to lift the mood at St James' Park, and defender Ciaran Clark and substitute Aleksandar Mitrovic sent the locals among a crowd of 52,093 home happy with second-half strikes.
It was exactly was the promoted Magpies needed after weeks of claim and counter-claim on Tyneside and ahead of a hugely important final few days of the transfer window.
By contrast, Hammers boss Slaven Bilic, the subject of reports that Benitez is being lined up to replace him, left the north-east reflecting on a third successive Premier League defeat and with a deepening gloom surrounding his own club.
If there has been tension within the four walls of St James' in recent weeks - and there has with Benitez making little attempt to disguise his frustration with the club's summer transfer dealings - there was a more immediate anxiety as the Magpies attempted to open their league account at the third time of asking.
But for all the current squad may lack the depth of quality it will need to prosper in the top flight, the manager could not complain about the industry, endeavour or commitment of the 11 men he sent out against the Hammers.
That was typified by bargain basement acquisitions Mikel Merino and Joselu, who spearheaded a spirited first-half display which ended with their side deservedly ahead.
Joselu had already fired wide at the near-post when Isaac Hayden only just cleared the crossbar with a rising 18th-minute shot.
Aaron Cresswell went even closer at the other end in a rare West Ham attack 14 minutes before the break, but it was the home side who finally broke the deadlock five minutes later.
Matt Ritchie, closing down tirelessly, caught Declan Rice in possession and allowed Merino to pick out Atsu's run into the penalty area, where the Ghana international squared unselfishly for Joselu to slide home.
Joe Hart had to save from both Merino and Atsu as the half ran down with Newcastle well on top.
The Magpies came close to extending their lead within two minutes of the restart when Joselu flicked the ball into the path of Ayoze Perez and saw him draw a finger-tip save from Hart with a skidding effort.
But it was opposite number Rob Elliot in the firing line as he blocked Cresswell's 53rd-minute piledriver and then got a hand to Javier Hernandez's follow-up and saw Clark scramble the ball off the line.
The second goal arrived with 18 minutes remaining when Ritchie hunted down Lanzini deep inside his own half and exchanged passes with Hayden before crossing for Clark to power a header past Hart off the inside of the post.
Mitrovic wrapped up the win four minutes from time when he rounded the England keeper and slide the ball into the empty net.