Soccer superstar Cristiano Ronaldo avoided jail time Tuesday after pleading guilty to tax fraud and accepted a two-year suspended prison sentence.

The 33-year-old, dressed in a black sports coat, black pants, and white tennis shoes, arrived at the Madrid court in a black van. He stopped to sign an autograph before walking up some stairs leading up to the courthouse. He was accompanied by his Spanish fiancee Georgina Rodriguez.

Ronaldo was inside for about 45 minutes and signed the plea agreement which will cost him nearly $21.6 million in fines. On his way out, he stopped to sign a few more autographs and did not speak to the few hundred journalists waiting outside the courthouse.

FLASHBACK: CRISTIANO RONALDO OFFERS TO PAY $21M TO AVOID JAIL IN TAX EVASION CASE

The Juventus forward was accused in 2017 by Spanish prosecutors of four counts of tax fraud from his time with Real Madrid. He was said to have hidden nearly $17 million in shell companies outside of Spain to avoid paying taxes on the income from his image rights.

He made the deal to plead guilty with Spain’s state prosecutor and tax authorities last year in an effort to avoid jail time.

The accusations against Ronaldo did not involve any of his salary from Real Madrid, his club from 2009 until joining Juventus in Italy last year.

Separately, Ronaldo is facing a rape allegation in the United States.

Kathryn Mayorga filed a civil lawsuit in Nevada in September claiming Ronaldo raped her in his Las Vegas hotel room in 2009. Police reopened an investigation into the allegation at her request. Ronaldo has denied any wrongdoing.

LAWYER IN CRISTIANO RONALDO RAPE CASE TO MEET WOMAN WHO CLAIMS TO BE STAR'S EX-GIRLFRIEND

Ronaldo is not the only superstar soccer player to be accused by Spanish prosecutors of tax fraud. His former Real Madrid teammate Xabi Alonso, who was also in court Tuesday, was accused of defrauding tax authorities of about $2.3 million from 2010-12.

Additionally, Barcelona and Argentina star Lionel Messi was handed a 21-month prison sentence in 2017 on similar charges. He was able to exchange the penalty for a fine.

Others who have faced similar charges include Luka Modric, Angel Di Maria, Marcelo, Javier Macherano, and Alexis Sanchez – all have played with Real Madrid or Barcelona.

CLICK HERE TO GET THE FOX NEWS APP

Between 2005 and 2010, foreign players in Spain were protected under the so-called “Beckham law” allowing them to curb their taxes. But the exemption was lifted as the financial crisis in the European country deepened.

The Associated Press contributed to this report.