He is best known in England for this spell but it was not a good one as he was part of the Villa side that were relegated from the Premier League.
The defensive-minded midfielder becomes the ninth player through the door at West Ham during a productive summer window for Manuel Pellegrini.
21-year-old Gomez scored 18 goals in 36 LaLiga games last term in what was his first season in Europe.
Wilshere - who also made the move from north to east London this summer - had posted an Instagram post before any confirmation from either club, which showed Perez in a West Ham kit, most likely in the changing rooms at the Hammers training facilities.
Perez arrived at the Olympic Stadium for just £4m - not even a quarter of the £17m the Gunners paid Deportivo la Coruna in 2016.
Having been included in Arsenal's pre-season tour of Singapore it appeared Perez was potentially going to be given a fresh start under new head coach Unai Emery.
Perez signed a three-year contract with the Hammers that sees him reunite with former Arsenal teammate, Jack Wilshere.
"He is a very experienced player that Manuel and I both know well from Spain".
"He has great technical quality, and can play as both the main striker or the second striker in a deeper role".
"Lucas also has experience of the Premier League with Arsenal, and is familiar with life here in London, which of course means that he will take less time to adapt and be ready".