The 29-year-old had plummeted down the pecking order, and was deemed surplus to requirements by new manager Unai Emery with the likes of Alexandre Lacazette, Pierre-Emerick Aubameyang and Danny Welbeck preferred.
Perez finally ends his nightmare spell at Arsenal after two difficult years in which he managed only 21 appearances - scoring seven goals - before rejoining Deportivo La Coruna last season on loan.
Arsenal are expected to have made a substantial loss on the signing of the striker, after luring him to north London in 2016 for £17million. Perez posted on Twitter after completing his move, describing it as a "great honour".
The Tweet is translated as: "From now on I'll defend these colours. It is a great honour to be part of this historic club. Let's fight together to achieve ️success."
West Ham already boast Javier Hernandez and Andy Carroll up front, while Toni Martinez has impressed in pre-season and Marko Arnautovic can play up front. But Jordan Hugill has joined Middlesbrough on loan.
The Hammers will be hoping Spaniard Perez is able to replicate the kind of form that saw him earn a big-money move to Arsenal in the first place.