Salah, who has not been at his best since returning from injury last month, was brought on in the 79th minute, just after the Hammers' second goal levelled the game
Sanchez broke the deadlock in the 60th minute of what had been a cagey game, selling the Saints defence a dummy before finishing left-footed for his 20th goal of the season, before Giroud headed a second with seven minutes remaining.
Arsenal moved above Manchester United into fifth on 66 points, three adrift of fourth-placed Manchester City with both having played 35 games. Arsene Wenger's side will also hope to reel in Liverpool, who have 70 points from 36.