Platforms may also have to seek out similar examples of the illegal content and remove them, instead of waiting for each to be reported.
One expert said it was a significant ruling with global implications.
Facebook said the judgement raised "critical questions around freedom of expression".
The case stemmed from an insulting comment posted on Facebook about Austrian politician Eva Glawischnig-Piesczek, which the country's courts said damaged her reputation.
Under EU law, Facebook and other platforms are not held responsible for illegal content posted by users, until they have been made aware of it - at which point, they must remove it quickly.
But it was unclear whether an EU directive, saying platforms cannot be made to monitor all posts or actively seek out illegal activity, could be overridden by a court order.
Austria's Supreme Court asked Europe's highest court to clarify this.
Thursday's ruling says three things:
Facebook is unable to appeal against this ruling.
"If there's a court order to say that someone's been defamed, then Facebook has to also search for different variations of it," Prof Steve Peers, from the University of Essex, told BBC News.
Privacy campaigner Max Schrems added that the ruling could have implications for Facebook's closed groups.
In the past, the social network had required users to identify each instance of a post they wanted to be taken down before the firm would tackle them. But since some of its pages are members-only, the victim might not be able to access them all.
Now, the onus would be on Facebook to find them, Mr Schrems suggested.
Facebook has said countries would have to "set out very clear definitions on what 'identical' and 'equivalent' means in practice".
It said the ruling "undermines the long-standing principle that one country does not have the right to impose its laws on speech on another country".
However, platforms can be compelled to take down posts worldwide within the framework of relevant international laws only.
"There's no harmonised defamation law internationally," said Prof Peers.
"Facebook might say we can't do this to the United States, because even though it infringes Austrian law, it doesn't infringe US law."
“If no one had an army, armies would not be needed. But the same can be said of most lobbyists, PR specialists, telemarketers, and corporate lawyers. Also, like literal goons, they have a largely negative impact on society. I think almost anyone would concur that, were all telemarketers to disappear, the world would be a better place.”
― David Graeber, Bullshit Jobs: A Theory