US President Donald Trump has grudgingly signed into law new sanctions against Russia, a move Moscow says amounted to a full-scale trade war and an end to hopes for better ties with Washington.

Congress overwhelmingly approved the legislation last week, passing a measure that conflicts with the Republican president's desire to improve relations with Russia.

While Trump signed the bill on Wednesday, he criticised it as infringing on his powers to shape foreign policy and said he could make "far better deals" with governments than Congress can.

Dmitry Medvedev, Russia's prime minister, called the sanctions tantamount to a "full-scale trade war," adding in a Facebook post that they showed the Trump administration had demonstrated "utter powerlessness".

OPINION: Is Russia a real threat to the West?

"The hope that our relations with the new American administration would improve is finished," he wrote.

Trump's litany of concerns about the sanctions, which also affect Iran and North Korea, nonetheless raised the question of how vigorously Trump will enforce them and pursue action against Russia.

"While I favour tough measures to punish and deter aggressive and destabilising behaviour by Iran, North Korea, and Russia, this legislation is significantly flawed," Trump said in a message to legislators.

The new law allows Congress to stop any effort by Trump to ease sanctions on Russia.

Trump said in a separate statement that he was signing the measure "for the sake of national unity", even though he saw problems with it.

'Raises serious questions'

His hands were tied after the Republican-controlled congress approved the legislation by such a large margin last week that any presidential veto of the bill would have been overridden.

Congress passed the measure to punish Russia over interference in the 2016 US presidential election and the annexation of Ukraine's Crimea.

The legislation has provoked countermeasures by Russian President Vladimir Putin, who said on Sunday the US diplomatic mission in Russia must reduce its staff by 755 people. Russia is also seizing two properties near Moscow used by American diplomats.

Trump has repeatedly said he wants to improve relations with Russia. That desire has been stymied by US intelligence agencies' findings that Russia interfered to help the Republican against Democratic presidential candidate Hillary Clinton.

US congressional panels and a special counsel are investigating. Moscow denies any meddling and Trump denies any collusion by his campaign.

Republican House of Representatives Speaker Paul Ryan welcomed the signing, saying in a statement it would send "a powerful message to our adversaries that they will be held accountable for their actions".

But Republican Senator Lindsey Graham said he was disappointed that Trump chose to sign the legislation behind closed doors, without the fanfare of television cameras and reporters present.

"The fact (that) he does this kind of quietly I think reinforces the narrative that the Trump administration is not really serious about pushing back on Russia," Graham said in a CNN interview.

The House's top Democrat, Nancy Pelosi, expressed concern about Trump's signing statement, saying it "raises serious questions about whether his administration intends to follow the law, or whether he will continue to enable and reward Vladimir Putin's aggression."

The new sanctions

Besides angering Moscow, the legislation has upset the European Union, which has said the new sanctions might affect its energy security and prompt it to act, too.

Several provisions of the law target the Russian energy sector, with new limits on US investment in Russian companies.

American companies also would be barred from participating in energy exploration projects where Russian firms have a stake of 33 percent or higher.

READ MORE: Russia - A resurgent superpower?

The legislation includes sanctions on foreign companies investing in or helping Russian energy exploration, although the president could waive those sanctions.

It would give the Trump administration the option of imposing sanctions on companies helping develop Russian export pipelines, such as the Nord Stream 2 pipeline carrying natural gas to Europe, in which German companies are involved.

Iran also spoke out against the sanctions, which it called a bid to sabotage the 2015 nuclear deal - but said it would not retaliate.

"We will not react with countermeasures, instead we will refuse to be drawn into this game and proceed with a level head," Deputy Foreign Minister Abbas Araghchi said, according to the ISNA news agency.