The European Commission, the bloc's executive arm, last month took Poland's right-wing government to the European Court of Justice for lowering the age at which Supreme Court judges must retire from 70 to 65.
"Poland must immediately suspend the application of the provisions of national legislation relating to the lowering of the retirement age for Supreme Court judges," the European Court of Justice said, Presstv Reported.
The Commission had asked the court in Luxembourg to take a decision as "soon as possible", warning that Warsaw was accelerating retirements.
Speaking in Brussels, Polish Prime Minister Mateusz Morawiecki said his government had during "the last few hours received the court of justice decision".
"We will certainly respond to it," he added.
"We will see what these (EU) institutions are proposing. When we take them into consideration, several possibilities will be analyzed."
The court said the order to suspend retirements "is to apply with retroactive effect" after noting that several judges had already been forced to retire.
The court, which said it would issue a final ruling at a later date, could impose fines if it finds Poland in breach of EU law.
The Commission has expressed concern the new retirement age will hasten the departure of judges appointed under previous governments, allowing the appointment of figures seen as loyal by Warsaw's current leadership.
The new retirement age requires more than a third of current Supreme Court judges to step down, including chief justice Malgorzata Gersdorf.
Calling the law a "purge", Gersdorf has refused to step down, citing a constitutional guarantee that she serve a six-year term until 2020.
The law more broadly violates Poland's obligations under the EU treaty, which it signed onto when it joined the bloc in 2004, the commission said.