The Bayern Munich boss will take over from Manuel Pellegrini on July 1 after the current manager revealed he was leaving the Etihad Stadium.
The 44-year-old Guardiola was in major demand across the continent, with Manchester United and Chelsea believed to be in the hunt, and the fact that he snubbed City’s main Premier League rivals serves as a major coup for owner Sheik Mansour.
A statement from City said Chilean Pellegrini, 62, was “fully supportive” of the announcement being made.
The club said negotiations with former Barcelona coach Guardiola had been “a recommencement of discussions that were curtailed in 2012”.
Roberto Mancini was City boss at the time, and led them to the domestic title that year.
Pellegrini succeeded the Italian in 2013 and took the club to a Premier League and League Cup double the following season.
He has won 64 of his 99 Premier League games as a manager, a record only eclipsed by Jose Mourinho, who won 73 of his opening 99 league matches as Chelsea boss.
City could yet win four trophies under Pellegrini this season.
They are already through to the final of the League Cup and are second in the league behind Leicester City.
The Blues are also through to the knockout stages of the Champions League and will play Chelsea in the fifth round of the FA Cup.
“I talked to the club and I will finish my contract on the original date,” said Pellegrini on Monday.
“We signed a contract for one more year, but with a clause that one of the club or me cannot use that extended contract. So I will finish here on the original date.
“They are not doing anything behind me. I knew this a month ago. But I don’t think it’s good, this rumour and speculation about different things. I would prefer to finish the speculation today. That’s why I told the press, I told the players, and I spoke with the club two weeks ago saying that I would do it.”
Why City went for Pep
- Barcelona’s most successful manager with 14 trophies in four years, including three La Liga titles and two Champions Leagues.
- Took a year’s break before joining Bayern in 2013, following the club’s Champions League, Bundesliga and German Cup treble under Jupp Heynckes.
- Won the league twice in his two full seasons with Bayern, who are eight points clear in his third campaign. He is yet to win the Champions League with the German club and has been knocked out at the semi-final stage twice.
- They face Italian giants Juventus in the last 16 of Europe’s elite club competition in February and Guardiola said: “Winning the Champions League would make my time here complete.”
Former City winger Trevor Sinclair said news of Guardiola’s appointment was “a massive, massive statement” by the club and “huge news for all City fans”.
He told BBC Radio 5 live: “He’s the hottest manager out there. Every club would want him.
“And when you look at the recruitment possibilities now, that’s where you really start to get excited. He’ll be able to bring in some huge players.”
Liverpool manager Jurgen Klopp has been speaking to the media before his side’s game with Leicester on Tuesday, and said of Guardiola’s appointment: “He is one of the best managers in the world, no doubt about this.
“He had two big, big clubs where he has worked at and now he will do his job at Manchester City.
“Pep won everything in Spain, nearly everything in Germany, so I think he wants to win everything in England, that is clear.”