New Bayern coach Pep Guardiola had said last Wednesday that "it was Thiago or nobody" on his wish list of new players at the UEFA Champions League winners and the midfielder, who had also been linked with a move to Manchester United, will fly to Munich for his medical in the coming days.
Bayern will pay €20m for the 22-year-old with the extra five million coming from a future friendly match between the two clubs.
"Thiago Alcantara was the main wish of our new coach Pep Guardiola," Bayern chairman Karl-Heinz Rummenigge said.
"We are pleased that we succeeded in making this great transfer happen. Thiago has only just been elected the best player of the U-21 European Championship. He is a fantastic player with great perspective, which will strengthen Bayern."
Bayern claimed their sixth win from their sixth pre-season friendly on Sunday with a 4-0 win at German third division side Hansa Rostock.
But ahead of the Bundesliga resumption on 9 August, Thiago's arrival will only heighten competition in Bayern's midfield with Germany star Mario Gotze, another new signing from Borussia Dortmund, also vying with stars Arjen Robben, Franck Ribery, Toni Kroos and Thomas Mueller.