Pep Guardiola will take over as Bayern Munich boss at the end of the season, the Bundesliga club have confirmed.
The Spaniard has been linked with most of Europe's top clubs - and Chelsea, in particular - since leaving Barcelona at the end of last season.
Current boss Jupp Heynckes, 67, told Bayern in December that he intends to retire at the end of the season and the club's directors moved quickly for Guardiola, who has been living in New York on a break from football.
It was later confirmed that Guardiola and Bayern had agreed the three-year contract before Christmas.
Chief executive Karl-Heinz Rummenigge said: "We are very pleased that we have succeeded in getting Pep Guardiola, who was courted by many famous clubs.
"Pep Guardiola is one of the most successful coaches in the world. We look forward to working with him from July 2013."
Guardiola, whose four years as Barca boss brought 14 trophies including three La Liga titles and two Champions League wins, replaces a man who came within a penalty shoot-out of making Bayern European champions last season.
Bayern chairman Uli Hoeness said: "We are extremely grateful for Jupp Heynckes' work, and we would be very happy if the team would give this great coach a glorious farewell.
"As an adequate replacement for Jupp Heynckes only Pep Guardiola was of the right calibre."
Guardiola's agent later revealed that the deal has been in place for weeks.
"He signed before Christmas. I don't know exactly which day, around the 20th or the second half of December," Josep Maria Orobitg told EFE Radio. "He chose Bayern because of all the teams from which he had offers it was the best.
"We were looking over the offers and this isn't the team which offered the most money. It was chosen for the organisation there, for the potential that he sees, and for their players."
Since leaving Barcelona last summer, Guardiola has taken a career break but his talents have been courted ever since.
"I can imagine that he was overwhelmed by offers," said Franz Beckenbauer, the Bayern honorary president.
Beckenbauer told Germany's Sky Sport News HD: "I have to congratulate Bayern for bringing in Guardiola."
Guardiola's appointment came as a shock to former Chelsea manager Andre Villas-Boas.
Villas-Boas, now at Tottenham, told CNN World Sport: "I'm so surprised that I asked my media advisor from Tottenham if it was true. Obviously it's a big, big club - one of the biggest clubs in the world - in a league where we didn't maybe expect Guardiola to be in."
Trizia Fiorellino, chair of the Chelsea Supporters Group, said she saw no obvious candidate to step in this summer at Stamford Bridge after Guardiola chose Bayern.
Fiorellino said: "I think the fans are just wondering what this means for us.
"I don't think Roman Abramovich made any secret Guardiola was our first choice.
"It's time to look elsewhere but there's no-one really available.
"Some are hoping Jose (Mourinho) comes back, others fancy Jurgen Klopp, the Borussia Dortmund manager."
Will Pep Guardiola be a success at Bayern Munich?