* Thiago to sign four-year contract (Adds details, quotes)
MADRID, July 14 (Reuters) - European champions Bayern Munich have strengthened their midfield by agreeing to buy sought-after Spain Under-21 international Thiago Alcantara from Barcelona for a fee of 25 million euros ($32.6 million).
Thiago, 22, who will join up again with former Barca coach Pep Guardiola in Munich, will have a medical in the next few days before signing a four-year contract, Bayern said on their website (www.fcbayern.telekom.de) on Sunday.
Barca also confirmed the deal, which it said included a friendly between the two clubs sometime in the next four years.
Bayern said 5 million euros of the transfer fee would come partly from income from the match and partly from Thiago agreeing to forego some wages.
"Thiago Alcantara was the great wish of our new coach Pep Guardiola," Bayern chief executive Karl-Heinz Rummenigge said.
"We are delighted that we have been able to seal this great transfer," added the former Bayern and Germany player.
"He is a fantastic player with great promise who will strengthen FC Bayern."
A graduate of Barca's youth academy, Thiago was seen as a possible successor to Xavi in central midfield but media reports said he was frustrated at a lack of playing time and he attracted the attention of several of Europe's wealthiest clubs.
His brilliant captain's performance in last month's European Under-21 championship final, when he netted a hat-trick in Spain's 4-2 win over Italy, only boosted his profile and he was named player of the tournament by UEFA.
While still not the finished article, he has the same ability as Xavi, who turned 33 in January, to dictate play, is blessed with superb distribution and close-control skills, is a tenacious tackler and has a burst of pace that can take him gliding past a marker.
Born in Bari, Italy, he is the son of former Brazil midfielder Mazinho, who played in the 1994 World Cup-winning side, and has a younger brother Rafinha, also a midfielder, in the Barca B team.
Thiago made 15 starts in La Liga as Barca won the title last season, two appearances in the Champions League and seven in the King's Cup. He has also played three times for the senior Spain side but missed out on a place at the Confederations Cup. ($1 = 0.7661 euros) (Reporting by Iain Rogers; Editing by Sonia Oxley)