Arsenal moved above West Ham in to the Premier League top five after inflicting a first home defeat on the Hammers since August.
Alex Song had a 20-yard volley ruled out for offside for the hosts.
Santi Cazorla put the visitors ahead from the penalty spot, following a foul by Winston Reid, before Danny Welbeck put Arsenal further in front.
Cheikhou Kouyate’s header gave the hosts hope but West Ham were unable to avoid a second successive defeat.
It was Arsenal’s ninth win in a row in all competitions against West Ham as they moved level on points with fourth-placed Southampton and just three points behind Manchester United in third.
West Ham boss Sam Allardyce, who opted to rest key players Song and Diafra Sakho for the 2-0 defeat at Chelsea on Boxing Day,disagreed strongly with the decision to disallow Song’s goal, claiming Sakho was not in the eyeline of the goalkeeper when he was adjudged to be offside.
The Hammers had won six of their last seven league home games but, despite heavy late second-half pressure, lacked the quality needed for the leveller.
Former Arsenal man Song, on loan from Barcelona, almost made an instant impact with a low volley into the bottom corner of the net from 20 yards early on. Sakho was penalised for standing in an offside position in front of goal, though, despite not touching the ball.
While Allardyce’s men have exceeded expectations this season, Arsenal have had a mixed start to the campaign and they were very much on the back foot in the opening stages.
But the Gunners had failed to score in only one of their last 11 away matches in the Premier League and they were at it again before the break.
Cazorla punished Reid’s high leg in the box to roll home the resulting penalty for the opener. The lead was doubled minutes later as Welbeck was on hand to slide the ball in to the net from close range after Alex Oxlade-Chamberlain’s low cross from the right.
Stunned by the deficit, West Ham restored hope soon after the break with Kouyate bundling Sakho’s cross from the right in to the net via Mathieu Debuchy.
But it was Arsenal who had the better chances, with Hammers keeper Adrian brilliantly denying Alexis Sanchez and Oxlade-Chamberlain, before the visitors survived a late aerial bombardment.