Brazilian Supreme Federal Court judge Alexandre de Moraes on Friday ordered the suspension of X in the country.
"The attacks this year on free speech are unprecedented in the 21st century," Musk wrote on X.
Moreover, individuals or companies using the X social media platform after its suspension in Brazil will pay a fine worth about $9,000, according to a court statement.
"Judge Alexandre de Moraes of the Supreme Federal Court ordered the immediate and complete suspension of X in the country... The decision sets a daily fine of 50,000 reais [over $8,900] for individuals and legal entities that use technological tricks to continue using X," the statement said.
Moraes earlier ordered Musk to notify the court within 24 hours about who would be the new legal representative of X in Brazil, saying otherwise it would be suspended.
The deadline expired on Thursday evening. X said on Friday it refuses to comply with "illegal orders" from a court in Brazil and expects to be shut down in the country.
In mid-August, X published a letter from Moraes with demands for censorship and user account information that it said could affect users not only in Brazil but also in the United States and Argentina. Shortly before that, X posted a letter from the judge requesting the censorship of several accounts held in Brazil.