The 64-year-old Chilean left his role with Hebei China Fortune over the weekend and flew to London for talks.
The Hammers opted not to keep Moyes on after the Scot's short-term contract ended following the final game of the Premier League season — a 3-1 win over his former side Everton that saw them finish 13th.
Joint chairman David Sullivan hailed Pellegrini's track record of winning the Premier League title with City as crucial to his chances of ushering in a new era of success at the London Stadium.
"I am delighted to welcome Manuel Pellegrini to West Ham United, he is one of the world's most respected football coaches and we look forward to working with him,” Sullivan said on the club's website.
Explaining the appointment Sullivan said: "It was important that we appointed someone with knowledge and experience of the Premier League, who already has an understanding — not only of the teams and players we face — but of West Ham United and our ambitions."
Sullivan said the new manager will be able to draw talent to London: "Manuel brings a reputation for attacking football and getting the best out of his players. We believe he will attract new talent to the London Stadium as well as improving the current squad."
Pellegrini coached at Villarreal, Real Madrid and Malaga in Spain before taking charge of Manchester City in 2013, going on to win the 2013/14 Premier League title as well as the League Cup twice before his departure.
He left the Etihad Stadium in June 2016, to be succeeded by Pep Guardiola, but was soon back in work at Hebei.
Despite being under contract through to the end of 2018 and with a reported release clause of $7 million, Hebei confirmed on Saturday that Pellegrini had left his role.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ