After weeks of speculation, Cristiano Ronaldo has agreed to a transfer from Real Madrid to Italian power Juventus, the Spanish club announced Tuesday.

Ronaldo, a five-time winner of the Ballon d’Or as the world’s best player, scored a team-record 451 goals in 438 games for Real Madrid since 2009 and helped lead the La Liga powerhouse to four Champions League titles over the past five seasons to go with two league championships and two Copa Del Rey titles.

“Today, Real Madrid wants to express its gratitude to a player who has proved to be the best in the world and who has marked one of the brightest times in the history of our club and world football,” Real Madrid said in a statement. “Beyond the conquered titles, the trophies achieved and the triumphs achieved in the playing fields during these nine years, Cristiano Ronaldo has been an example of dedication, work, responsibility, talent and improvement.”

Sergio Ramos, Ronaldo’s teammate for the entirety of his Real Madrid tenure, expressed similar thoughts on Twitter, writing “your goals, your numbers and everything we have won together speak for themselves. You have deserved a prominent place in the history of @RealMadrid. The Real Madrid fans will always remember you.”

Juventus will pay Real Madrid a 100 million euro transfer fee (about $117.4 million), according to the Guardian, just the seventh transfer fee of at least 100 million euros in soccer history. The 33-year-old Portuguese star will sign a four-year contract worth about $35.2 million annually. In total, Juventus will pay nearly $400 million to acquire Ronaldo if you include the transfer fee, his total salary and Italian taxes. (Soccer teams in that country have to pay the same amount as the player’s salary in tax.) ESPN says it’s the second-biggest total transfer fee in history, behind only Neymar’s move from Barcelona to Paris Saint-Germain last summer.

According to multiple reports, Juventus President Andrea Agnelli traveled to Greece on Tuesday to meet with a vacationing Ronaldo, who was last seen leading Portugal to the World Cup round of 16. Juventus eyed Ronaldo in hopes of returning to Champions League glory: Although it has won seven straight Italian league titles and four consecutive Coppa Italia crowns, the Turin club has not taken home Europe’s prized club championship since 1996, including runner-up finishes in 2015 and 2017.

Ronaldo’s move out of Spain reportedly was spurred in part by tax-evasion accusations levied by prosecutors there. On the eve of the World Cup last month, Ronaldo reached a deal with Spanish prosecutors, agreeing to a $21.8 million fine and suspended prison sentence. (As a first-time offender, he’s unlikely to serve any time.) Real Madrid, meanwhile, sheds a player who will turn 34 in the middle of next season — an age in which many stars already have begun to decline — along with his massive salary, allowing the club to seek a big-name transfer of its own (Neymar? Kylian Mbappe? Eden Hazard?) or accumulate a number of players who can help it stay on top.

Juventus and Real Madrid will meet in an exhibition game Aug. 4 at FedEx Field, but it’s unclear whether Ronaldo will join his new team on that trip.

Read more from The Post:

‘Hard-working, compact, united and well organized’: The World Cup’s surprising final four

Russia is knocked out of World Cup by Croatia, after showing fight no one imagined

England’s unexpected rise reaches World Cup semifinals, and its fans’ chorus grows louder

Belgium leaves Brazil reeling and raving, another World Cup giant on the side of the road

France takes total control in beating Uruguay — and hints at more to come in World Cup