Villa’s Ollie Watkins was denied a stoppage-time equaliser after an agonising VAR wait deemed his upper arm was offside.
The former Brentford man also hit the bar with a penalty as the spirited visitors pressed for the leveller their play more than deserved.
David Moyes has quietly established the Hammers as an effective outfit this season and they got off to the perfect start when Angelo Ogbonna buried a header past Emiliano Martinez inside the first two minutes.
But Moyes rang the changes at half-time and it paid immediate dividends as substitute Said Benrahma set up Jarrod Bowen for a delightfully deft header immediately after the break to retake the lead.
Villa had plenty of chances to draw level but were left to rue Watkins’ profligacy and VAR’s ruling.
West Ham United, meanwhile, gratefully took the win to move to within four points of Tottenham and the Premier League summit.