Zabaleta will formally begin a two-year deal with the London club on July 1, when his City contract expires.
The 32-year-old had already been released by City, for whom he made more than 200 appearances after joining from Espanyol in 2008.
“This is an absolute pleasure to be part of West Ham. I hope I can give you good moments. Of course, I come to the club to enjoy myself and hopefully we can have a very successful time,” Zabaleta told West Ham TV.
Zabaleta won the Premier League twice as well as the 2011 FA Cup and two League Cups during his time at City, where he became a popular figure with fans as a symbol of the club’s modern resurgence as a major force in English football.
Zabaleta, who revealed he turned down offers from Italy, Spain and also elsewhere in England to sign for the Hammers, now hopes to play his part in helping the east London club improve on last season’s mid-table finish.
“Sometimes a new challenge is all you need as a person and as a player. I thought my time at City was done. It has been a fantastic nine years, absolutely brilliant,” he said.
“Manchester City gave me the opportunity to come to this wonderful league, the Premier League, something I’ve been enjoying a lot as a player. And, of course, for me it was probably the right time to move on.
“Also, as a player, I thought I wanted to keep playing in the Premier League.
“For me, after being in this country for so long, this is a new challenge for me in the Premier League and I’m ready for it and looking forward to it.”