The law "introduced discriminatory and unjustified restrictions with regard to both the organizations at issue and the persons granting them such support," the Luxembourg-based Court of Justice of the European Union said in a ruling that cannot be appealed.
The law is part of measures taken by the Hungarian government against what it sees as unfair foreign influence, linked to its disagreements with Soros, who was born in Budapest.
Orban has accused non-governmental organizations (NGOs) funded by Soros of political meddling.
Soros has rejected the campaign against him as “distortions and lies” meant to create a false external enemy to distract Hungarians.
"We have respected the decisions of the Court of the European Union until now, so we will respect them in the future as well," Gergely Gulas, Orban's chief of staff told a weekly news conference.
The EU has also taken Hungary to court in the past after accusing the government of muzzling the media and academics, but has had little success in forcing Orban to change tack.
In March, Orban won the right to rule indefinitely by decree to combat the novel coronavirus, a step that drew criticism from the European Commission, the EU executive. Hungarian parliament revoked the special powers this week.