West Ham had frustrated Arsenal for much of the first half, but the Gunners edged ahead thanks to Alexandre Lacazette.
The goal was almost ruled out by VAR for offside in the build-up, however, after a check it was given.
Gunners captain, Pierre-Emerick Aubameyang, picked out Lacazette with a sublime assist, and though the Frenchman still had a lot to do, he powered home a header.
It was his 50th Arsenal goal in all competitions, and has to give him confidence for the season ahead.
Pictures from RMC Sport