West Ham slumped to a third defeat in eight days as Everton ended a difficult week on a positive note as Dominic Calvert-Lewin fired them to victory at London Stadium.
The Toffees were playing their first match since the death of chairman Bill Kenwright on Monday at the age of 78.
It had been emotional week, too, for Hammers manager David Moyes, who formed a close friendship with Kenwright during his 11-year spell in charge at Goodison Park.
But after West Ham suffered again after reverses at Aston Villa and in the Europa League at Olympiacos, Everton were able to put some more breathing space between themselves and the bottom three with a second away win of the season.
Calvert-Lewin's goal was his 50th in the Premier League for Everton, joining Romelu Lukaku, Duncan Ferguson and Tim Cahill in reaching the half-century.
It came six minutes into the second half after a first half that will not live long in the memory.
West Ham created an early opportunity when Lucas Paqueta skilfully lifted the ball over Nathan Patterson and drilled in a low cross which Jarrod Bowen could only slice wide.
Moments later Paqueta showed the side of his game which so infuriates Moyes, gifting the ball to Jack Harrison who burst through only to fire too close to Hammers keeper Alphonse Areola.
Ghana winger Mohammed Kudus, making first Premier League start for West Ham, showed he is already getting used to the darker arts of English football after he was chopped down by James Tarkowski.
As Jordan Pickford raced out of his goal to tell the youngster to get up, Kudus shoved the England keeper away in a skirmish which earned both a booking.
Calvert-Lewin had his first chance from Vitalii Mykolenko's cross but the striker headed over. And a torturous half was summed up by the audible sigh which echoed around the London Stadium when five minutes of stoppage time was announced.
The game desperately needed a goal and it almost came through Bowen, who got on the end of a James Ward-Prowse free-kick but guided his header too high.
Instead the goal arrived at the other end after Jarrad Branthwaite won the ball back for Everton in midfield and fed Calvert-Lewin.
The former England forward played a one-two with Harrison before executing a Cruyff turn which left Kurt Zouma and Nayef Aguerd flat-footed and firing low past Areola.
It was Calvert-Lewin's sixth goal in all competitions against the Hammers, the most he has scored against one single club.
Everton almost doubled the lead when Zouma and Aguerd got in another tangle but Areola got down well to tip Aboulaye Doucoure's shot wide.
The closest West Ham came to an equaliser was a Said Benrahma volley which Pickford kept out at his near post to secure the points.
West Ham United: Areola, Coufal, Zouma, Aguerd, Cresswell (Ings 85), Alvarez, Ward-Prowse (Soucek 73), Bowen, Kudus, Paqueta, Antonio (Benrahma 57).
Unused subs: Fabianski, Fornals, Mavropanos, Cornet, Ogbonna, Kehrer.
*copy from Press Association.
Comments: Our rules
We want our comments to be a lively and valuable part of our community - a place where readers can debate and engage with the most important local issues. The ability to comment on our stories is a privilege, not a right, however, and that privilege may be withdrawn if it is abused or misused.
Please report any comments that break our rules.
Read the rules here