Brentford delivered a huge blow to West Ham's top-four hopes as the Bees moved further clear of the relegation places with victory in west London.
Second-half goals from Bryan Mbeumo and Ivan Toney saw Thomas Frank's side climb to 13th in the table, 12 points clear of the relegation places, to all but confirm their Premier League safety.
Mbeumo fired in from Toney's pass shortly after half-time, before turning provider for his team-mate as Toney headed in after 64 minutes.
The hosts had appeared the more likely to break the deadlock before half-time, but the heavily-involved Mbeumo headed at Lukasz Fabianski and also saw a powerful strike pushed away by the West Ham goalkeeper.