Guardiola to take over at Bayern
Guardiola, 41, has been without a club since leaving Barcelona at the end of the 2011-12 season as he sought time away from football.
During his sabbatical in America, the Spanish coach has been linked with several clubs, including Manchester City, Chelsea, Arsenal and AC Milan.
However, Bayern have moved to secure his services for the 2013-14 campaign after they announced on Wednesday he has agreed a three-year deal at the Allianz Arena.
Guardiola, who won three Liga titles and two Champions League trophies during his time at Barca, will succeed Jupp Heynckes as Bayern boss.
Bayern confirmed the news on their official Twitter account: "Jupp #Heynckes will finish his successful career by the end of this season. Pep #Guardiola will take over as FC Bayern head coach in July."
"We are delighted that we were able to secure Pep Guardiola, who had been courted and contacted by many prestigious clubs," Bayern chief Karl-Heinz Rummenigge said.
"Pep Guardiola is one of the most successful coaches worldwide and we are convinced he will not only light up FC Bayern but also German football. We are looking forward to working with him from July 2013 onwards."
Bayern president Uli Hoeness added: "We are extremely thankful for the work Jupp Heynckes has done. After his decision to leave we would be delighted if the team ensured of him an illustrious farewell. Only a big gun like Pep Guardiola came into question as an appropriate successor for him."
Borussia Dortmund chief executive Aki Watzke congratulated the Bavarians on a major coup, telling Die Welt: "This is fantastic. A big compliment must go to Bayern for staging this coup. It's extremly good for the league, with the world realising it is possible to bring such a coach to Germany. The pressure on Bayern will certainly not lessen."
Heynckes, 67, is currently enjoying his third stint as Bayern boss, with the club in command of the Bundesliga, as they lead the table by nine points with 17 matches played. It is thought the German was privy to the club's plans to acquire Guardiola's services.