Several congressional committees and a special counsel are investigating whether there was any coordination between the Kremlin and Mr. Trump’s campaign advisers to influence the 2016 election to benefit Mr. Trump. The president has called the investigations a “witch hunt.”

Russia had pre-emptively responded to the new sanctions by seizing two American diplomatic properties in Russia and ordering the United States to remove 755 members of its embassy staff stationed there. Mr. Trump has not publicly commented on the Kremlin’s response and did not invite the news media to cover the bill-signing event as he has for other laws. In a statement released on Wednesday, Mr. Trump called the law “significantly flawed,” and he said it included “a number of clearly unconstitutional provisions.”

Mr. Trump has said he wants to improve the United States’ relationship with Russia. He is not the first American president to bristle at Congress for interfering with the ability to set foreign policy.