The Spaniard took aim from 25 metres in the 74th minute and his effort looped in after hitting Villa’s Ezri Konsa.
It was reward for an improved second-half performance by West Ham who offered little before the break.
Villa were hardly much better in a turgid first half although they did have the ball in the net early on when Konsa got on the end of a Lucas Digne corner but the ball had rightly been adjudged to have gone out of play.
The victory lifted West Ham off the foot of the table into 17th place with three points, the same as Villa.
Had they been beaten without scoring West Ham would have become only the second team in the Premier League era not to register a goal or a point in their opening four fixtures, the other being Crystal Palace in 2017-18.
“It’s a great three points. The Premier League is tough at the moment. There’s very little between the teams, games are really tight and that’s the way it was today,” West Ham manager David Moyes said.
“Any win away from home is a really good result. We’ve had a really good two-and-a-half years so any external voices should be talking about that.”
In reality, West Ham’s triumph fell very much into the bracket of the “points were all that mattered” as it was a game largely devoid of top-flight quality.
And while Moyes was clearly relieved to get the Hammers season up and running, the focus shifted to Steven Gerrard whose side have lost three of their opening four games.
They face 100% leaders Arsenal on Wednesday and host champions Manchester City in their next two games so these are concerning times for Gerrard.
To add to his woes, playmaker Philippe Coutinho, the only Villa player to really impress, was forced off with an injury.
West Ham’s winner summed up Villa’s afternoon.
There did not look to be much danger when Fornals picked the ball up but his hopeful shot struck Konsa and looped agonisingly over Emiliano Martinez.