The match was played at London Stadium, where Brentford produced a strong performance to claim all three points.
Igor Thiago opened the scoring for Brentford before Mathias Jensen added a second goal to seal the victory.
West Ham failed to find the net despite their efforts, suffering another defeat in the league.
The win took Brentford to 10 points and 13th place in the Premier League table.
The English top flight is currently in its 34th season, with teams competing for points as the league campaign continues.