Specifically, the Court of Justice said that visa restrictions forcing non-EU workers posted to Germany by European service companies to have worked a year at the firm prior to being sent are illegal.
The law, which was enacted last year, breaches one of the fundamental freedoms in the EU's founding treaty, the court said. Requiring at least a year's prior employment at the company is "disproportionate" to ensure social welfare protection or prevent wage dumping, the court said.
It said better legislation on minimum wages for temporary workers could achieve the same goal. Currently, Germany does not have a minimum service wage.
"The court concludes that Germany has infringed the provisions on the freedom to provide services," a statement by the EU's highest jurisdiction said.
Before issuing visas, German diplomatic missions currently are required to make sure that the worker has been employed for at least one year by the company planning to post him or her.
Berlin tightened its rules after a scandal over lax visa policies under former Foreign Minister Joschka Fischer, which critics said permitted a wave of migrants, including criminals, from countries such as Ukraine to settle in Germany.