Douglas Costa made 31 appearances in his maiden season in Serie A, scoring four goals and assisted on 14 more. The Brazil international, who is currently preparing with his country for the World Cup, also appeared in all ten of Juve's Champions League fixtures.

"Juventus Football Club S.p.A. has exercised the option right for the definitive acquisition of the registration rights of the player Douglas Costa de Souza from FC Bayern München AG for a consideration of €40million to be paid in two financial years," a statement read.

"The consideration may increase of €1 million on achieving given conditions in the course of the duration of the contract. Juventus and the player signed a contract of employment until 30 June 2022."

Bayern Munich CEO Karl-Heinz Rummenigge confirmed last November that Costa would move at the end of the season after the 27-year-old went on a season-long loan to the Italian champions in July with a view to a permanent transfer.

After joining Bayern from Shakhtar Donetsk for €30m in 2015, Costa enjoyed a bright first season in Germany, scoring four and assisting 14 goals in 27 Bundesliga appearances under Pep Guardiola. He also scored the decisive penalty in the DFB Pokal final shootout victory against Borussia Dortmund as Bayern secured the Double in Guardiola's final game in charge.

However, Costa, who had to contend for a place on the flanks with Arjen Robben, Franck Ribery and Kingsley Coman, struggled to back up his strong debut campaign and started only 14 of Bayern's 34 Bundesliga games.

The winger becomes the most expensive sale in Bayern's history -- surpassing the €30m received from Real Madrid for Toni Kroos in 2014.

Information from Italy correspondent Ben Gladwell and Bayern Munich correspondent Mark Lovell was used in this report.

Follow @ESPNFC on Twitter to keep up with the latest football updates.