The Italian republic "violated its obligations to respect the immunity which Germany enjoys under international law by allowing civil claims based on violations committed by the German Reich between 1943 and 1945," International Court of Justice judge Hisashi Owada told a public hearing.
"The Italian republic must, by enacting appropriate legislation, or by ... other methods, ensure the decisions of its courts infringing the immunity which Germany enjoys under international law cease to have effect."
The two European Union members have been locked in a legal battle since December 2008, when Germany filed an application before the ICJ after an avalanche of lawsuits by Italian relatives and widows for abuses by Adolf Hitler's Third Reich.
The cases sought compensation for deportations of Italians and other acts by German troops in Italy after Rome quit the Axis and joined the Allies in September 1943.
Berlin said that by permitting claims for abuses that occurred between September 1943 and May 1945, Italy "failed to respect the jurisdictional immunity" that modern-day Germany enjoys under international law.
Italy on the other hand, argued that the cases were admissible as abuses committed by German troops that amounted to "international crimes," which have precedence over state immunity.
During the hearing at ICJ headquarters in The Hague, Owada said "practice showed that immunity among states generally proceeded on the basis of international law."
"The court considers the rule of state immunity plays an important role. It is a fundamental principle of international legal order," he added.
Germany on Friday welcomed the ruling, with its main representative Susanne Wasum-Rainer telling AFP: "We think it is a very important decision for all states to have a judgement on state immunity."
But Italy's Paolo Pucci di Benisichi said he was "concerned, surprised and regretful," adding "this case would not have taken place here in The Hague if the compensation issue had been dealt with in a good way."
The row between the two countries began when Luigi Ferrini, who was deported as a forced labourer to Germany in August 1944, claimed compensation from the German government.
A 2004 Italian Supreme Court decision in his favour led to a flurry of claims by relatives and widows of Nazi war crimes victims, which Germany has refused to meet.
Also before the ICJ as a non-party state was Greece, because of victims of a 1944 German massacre at Distomo, in which 218 people were killed.
Relatives of the Greek massacre victims refiled a case before Italian courts, after a Greek court failed to enforce a ruling for Germany to pay €28.6 million in compensation to the plaintiffs.
Berlin has also consistently refused to compensate the Distomo claimants, saying the case had been settled between the two countries in 1960.
The ICJ concluded decisions by Italian courts in the Distomo case constituted "a violation by Italy to respect Germany's jurisdictional immunity."
Established in 1945, the ICJ is the UN's highest court and settles disputes