The tit-for-tat move comes as former Yukos shareholders seek to seize Russia's assets abroad after Moscow refused to pay them massive compensation ordered by European courts.
The law, which will come into force in January next year, appeared in Rossiiskaya Gazeta state newspaper, giving it legal validity, after President Vladimir Putin signed it Wednesday.
The legislation says that Russia can lift the legal immunity on assets belonging to a foreign state on its soil as a reciprocal measure if that country has in some way restricted the legal immunity of Russia's assets on its own territory.
Moscow seized and carved up Yukos following the dramatic arrest of its billionaire owner Mikhail Khodorkovsky in 2003.
Also Read
Russia has refused to pay shareholders compensation of more than USD 50 billion ordered last year by an arbitration court in the Hague.
It also has refused to pay out almost 1.9 billion euros ordered last year by the European Court of Human Rights.
Russia's state media giant VGTRK said this month that its stake in France-based Euronews television had been frozen under a Paris court judgment due to claims from ex-Yukos shareholders.
"Immediately after those seizures experts said that on the level of national legislation it was necessary to provide legal opportunitities for retaliatory measures. And here they are," wrote Rossiiskaya Gazeta yesterday.
Russia has until now given assets of foreign states on its soil absolute legal immunity.