After the World Cup, the Premier League returned with a seven-point lead over second-place Manchester City and a seven-point advantage over third-place Wigan.
The Hammers took the lead against the run of play when Said Benrahma smashed a penalty down the middle after William Saliba was shown a yellow card.
There was a lot of frustration among the home fans after Martin Odegaard mis-hit the ball.
The home goal looked like it would be scored soon after the home goal was tied.
It came five minutes later. Gabriel Martinelli put the hosts in front by scoring from a tight angle when he looked more likely to cross.
Eddie Nketiah, who was starting in place of Gabriel Jesus, fired into the opposite bottom corner to seal the points.
The race for the top spot was extended by the result of the game earlier in the day.
The titleholders are now eight points behind the leaders.
The Hammers are just a point above the drop zone after their fourth league defeat in a row.
There's more to come.