Villa had the clearer chances in the first half, but David Moyes’ Hammers took the lead six minutes after the break.
Michail Antonio held up the ball up before finding Said Benrahma, who picked out Tomas Soucek. The Czech Republic midfielder then fired a shot into the far corner for his eighth goal of the season.
Ollie Watkins scored his 11th goal of the season for Villa to reduce the deficit 10 minutes from time, but that prompted a quick response from Lingard, who lashed a shot that squirmed though the grasp of Martinez to seal a West Ham victory that lifts them to fifth in the table on 38 points.
Villa, meanwhile, are ninth on 32.