BERLIN (Reuters) -- Midfielder Sami Khedira, who played a major part in Germany's run to the World Cup semifinals, is joining Real Madrid from VfB Stuttgart on a five-year deal, the clubs said on Friday.

The 23-year-old, who has a German mother and a Tunisian father, cost the La Liga giants 12 million euros ($15.7 million), according to Spanish media reports.

He is the fourth reinforcement for new Real coach Jose Mourinho following the purchase of Argentina winger Angel Di Maria and Spanish midfielders Sergio Canales and Pedro Leon.

Mourinho was hired to replace Manuel Pellegrini at the end of last season's trophyless campaign, and the club is seeking to end the two-season reign of arch-rivals Barcelona as Spanish champions and win a first Champions League title since 2002.

Khedira made his international debut in a friendly against South Africa last September and was not expected to feature in Germany's World Cup team but was given his chance following the injury that kept captain Michael Ballack out of the tournament.

He formed an impressive partnership with Bastian Schweinsteiger as Germany finished third. He has 12 caps and scored his first international goal in the World Cup third-place playoff against Uruguay.

VfB, where Khedira made his professional debut in 2006, said they were sorry to see him go.

"One is always extremely unhappy to let go a player who dictates the game and is easily identified with, such as Sami Khedira," said Stuttgart's sporting director Fred Bobic.

"On the other hand, we were able to fulfil Sami's wishes of furthering his career at Real. We wish him all the success with his new challenge."

SI Apps
We've Got Apps Too
Get expert analysis, unrivaled access, and the award-winning storytelling only SI can provide - from Peter King, Tom Verducci, Lee Jenkins, Seth Davis, and more - delivered straight to you, along with up-to-the-minute news and live scores.