The cookie is installed when an internet user visits a Facebook page even if they are not members.
However, the Belgian court said that the company was obliged to obtain consent to collect the information being gathered.
"The judge ruled that this is personal data, which Facebook can only use if the internet user expressly gives their consent, as Belgian privacy law dictates," it said in a statement.
If Facebook fails to comply, it could face a fine of up to 250,000 euros (£180,000) per day.
The fine would go to the Belgian Privacy Commission, which brought the case, the court added.
Cookies are simple files that track whether a user has visited a website before and notify the site itself.
They can track a number of user activities, such as how long they stayed, what they clicked and any preferences selected.
"We`ve used the Datr cookie for more than five years to keep Facebook secure for 1.5 billion people around the world," said a Facebook spokesperson.
"We will appeal this decision and are working to minimise any disruption to people`s access to Facebook in Belgium."
More about: