Despite a valiant display, goals from Jarrod Bowen and Michail Antonio either side of Matheus Pereira's equaliser condemned the Baggies to defeat at the London Stadium.
Bowen's close-range finish had given the hosts the lead just before the interval, but the Baggies showed their intent with a quick response in the second half thanks to Matheus Pereira's precise finish.
Forward Antonio regained the lead for the hosts 15 minutes later and despite chances for Conor Gallagher and substitute Darnell Furlong, Albion returned to the Black County empty-handed.
Sam Johnstone completed his recovery from COVID-19 to return between the sticks for the Baggies while Gallagher, who was suspended for the 3-2 win at Molineux, replaced Robert Snodgrass, who was unavailable to face his former club.
The Baggies started cautiously in the East End, looking to build solid foundations on which to launch attacking forays into the West Ham half.
After a quiet opening, Pereira was the first player from either side to fire a shot in anger on 13 minutes, blazing a 20-yard strike over Lukasz Fabianski’s goal from Kamil Grosicki’s lay-off.
Albion almost took a fortuitous lead six minutes later when Angelo Ogbonna forced a save from his own goalkeeper, misdirecting an attempted clearance from Jake Livermore’s high ball into the area.
Vladimir Coufal registered the game’s best chance to date on 22 minutes – driving a left-foot half-volley, which took a decisive deflection off Romaine Sawyers, before whistling wide from 20 yards.
The Baggies continued to build dangerous counter-attacks and Callum Robinson fired over following a neat one-two with Gallagher just after the half-hour mark.
The hosts came closer still on 35 minutes when Manuel Lanzini saw a 25-yard free-kick ripple the top of the net.
Albion almost reached half-time unscathed but the Hammers dealt Allardyce’s men a disappointing blow in first-half stoppage time. Coufal drilled the ball into the six-yard box from Benrahma’s left-wing cross and Bowen was on hand to chest the ball in from close range to give West Ham the lead at the break.
The Baggies came out brightly after the interval with Gallagher forcing a save from Fabianski four minutes after the restart.
Albion were level two minutes later and it was derby-day hero Pereira who equalised with his fifth goal of the season.
The Hammers had not conceded in their previous four matches in all competitions, but they gave the Brazilian enough time and space to drive a low left-foot strike inside the right upright from 18 yards.
However, the home side nearly struck straight back at the Baggies, with Dara O’Shea being forced into evasive action to head off the line.
Declan Rice almost followed up that goal-line clearance from the Irish defender with a long-range drive. But his shot just missed the bottom corner as David Moyes' side continued their assault on the Albion goal.
Just a few minutes later, the Hammers regained the lead when the Baggies failed to deal with a cross into the box and Antonio adjusted his body to finish low past Johnstone.
After going ahead again, the Irons sat in as they invited Allardyce's men into their half. The energetic Gallagher produced a fast response when he came close to an equaliser - volleying Kieran Gibbs' cut-back on target, but straight at Fabianski.
But the best chance fell to defender Furlong in the dying embers. Following good interplay between Pereira and Gallagher, a dangerous cross was ran onto by Furlong whose left-foot strike looked to be going towards the bottom corner.
Unfortunately for the Baggies, the full-back's effort went wide and although the Video Assistant Referee checked a potential late penalty for a foul on Kyle Bartley, they fell to a third defeat in four Premier League matches.
Albion: Johnstone; O'Shea, Ajayi, Bartley, Gibbs; Livermore (Robson-Kanu 80), Sawyers; Grosicki (Furlong 70), Pereira, Gallagher; Robinson.
Substitutes: Button, Peltier, Kipre, Ivanović, Field, Edwards, Krovinović.