A short statement from the Primera Division side said a fee of 25 million euro (£21.6million) had been agreed for the 22-year-old.
"FC Barcelona and FC Bayern Munich have reached an agreement over the transfer of the player Thiago Alcantara to the German club for a total of 25 million (euro)," it read. "This agreement also includes holding a friendly match between the two teams, which will be played in the next four years."
Bayern director of sport Matthias Sammer had played down reports suggesting that Thiago was heading to the Allianz Arena.
However, the European champions confirmed the Spain international is set to put pen to paper on a four-year deal in a move which will see him link up with former boss Pep Guardiola.
"The Spanish midfielder will travel in the coming days to Munich to attend the medical examination and sign a four-year contract until June 30, 2017," read a statement on Bayern's website.
Chairman Karl-Heinz Rummenigge added: "Thiago Alcantara was the biggest wish of our new coach Pep Guardiola. We are pleased that we have succeeded in this great transfer.
"Thiago has only just been named the best player at the European Under-21 Championship. He is a fantastic player with great perspective, which will strengthen Bayern."
Thiago's performances had seen him linked with several clubs across Europe, including Manchester United, with Guardiola reported as saying the midfielder was his number one transfer target.
He starred in Spain's recent European Under-21 Championship success, scoring a hat-trick in the final against Italy.