Roared on by the Magpies' first capacity home crowd for 17 months, Newcastle started brightly as Callum Wilson headed home Allan Saint-Maximin's teasing delivery.
An intended cross by Aaron Cresswell crept in to quickly get West Ham level before Jacob Murphy's header restored Newcastle's lead at half-time. But David Moyes' men showed why they finished sixth ahead of Tottenham and Arsenal last season after the break.
Newcastle could not live with the pace and inventiveness of Said Benrahma and Michail Antonio. They combined to get the visitors level once more on 53 minutes as Benrahma stooped to head home Antonio's cross.
Antonio then hit the post with a header from point-blank range, but on the rebound Murphy tripped Pablo Fornals inside the box.
On his Premier League debut, Freddie Woodman saved Antonio's penalty, but Tomas Soucek pounded on the rebound to put West Ham in front.
Three minutes later Benrahma fed Antonio on the counter-attack and this time he made no mistake with a thumping finish to move level with Paolo Di Canio as West Ham's all-time top goalscorer in the Premier League.
Standout matches today