The European Court of Justice has ruled that the European Commission has not been quick enough in identifying and banning potentially harmful "endocrine disruptor" chemicals.
Some researchers say endocrine disruptors may affect human hormones and cause disease.
The court said that the decision could be appealed within two months.
It added that a judgement such as Wednesday's, finding that a European institution had "unlawfully refrained from laying down rules", was "comparatively rare".
The chemicals are found in many everyday products, from food and cleaning products to plastic containers and cosmetics.
The Swedish government welcomed the ruling and called for work to begin on "identifying and phasing out endocrine disrupting substances".
In its judgement, the court said that EU legislation adopted in May 2012 envisioned steps being taken to set criteria for testing for suspected endocrine disruptors.
In May 2014 Sweden brought the case against the Commission, saying its efforts had come to a "complete standstill" and that illnesses caused by the chemicals could be costing hundreds of millions of euros every year.
Describing the Luxembourg-based court's ruling as unprecedented, environmental group ClientEarth said that the chemicals involved affected human reproductive function in both men and women, increased the incidence of breast cancer and caused abnormal growth patterns in children.