The bill would require the executive branch to get a resolution of approval for any changes to sanctions — a significant restriction of the president's powers by his own party in Congress.
The White House announced Friday that Trump will sign the bill. His signature is expected sometime this week.
Under the Constitution, the president has 10 days to sign a bill (not counting Sundays) or veto it; if he does nothing, the bill will become law without his signature.
There were concerns among Republicans and in the oil and gas industry over a rule in the original Senate bill that would bar American companies and individuals from working with sanctioned Russian companies and individuals on big oil and gas projects.
The compromise for the two parties and the two chambers was to combine the Russian, Iranian and North Korean sanctions into one bill, with moderate technical changes.
The bill would set into law sanctions against Russia imposed by the Obama administration for Russian hacking of Democratic National Committee computers and interference in the presidential election — including the end of Russia's access to two diplomatic compounds in the U.S., one of which was allegedly used for espionage. And it would add penalties for Russian interference in Ukraine, Syria and the election hacking.
The Trump administration would be barred from making any changes to those sanctions or any others without congressional approval. It may apply for waivers under certain conditions — for example, if Russia makes progress on implementing a peace deal in Ukraine known as the Minsk agreement.
U.S. businesses could work with Russian entities on certain oil and gas projects outside Russia as long as they don't involve a sanctioned Russian individual or company owning a 33 percent stake or more.
While the bill would require congressional approval of any changes, it would allow the president to ask Congress to lift some of them if the White House can certify that certain conditions have been met — like Russian progress on the Minsk agreement or "significant" Russian efforts to "reduce the number and intensity of [its] cyber intrusions." As with other sanctions, it would permit the administration to designate new individuals and entities that are violating them and should be added.
The House passed its version 419-3, and the Senate vote was 98-2.
The resolution comes weeks after some squabbling among lawmakers. First, the Senate overwhelmingly passed its similar bill on Russia and Iran in June. The legislation then got stuck in the House, delayed over technical details, before the House wrote its own version, incorporating a bill it passed nearly unanimously in May for North Korea sanctions. After some negotiating, Senate Republican leadership agreed to take up that package.
"With near unanimous support in both chambers of Congress, this legislation sends a strong signal to Iran, Russia and North Korea that our country will stand firm and united in the face of their destabilizing behavior," Senate Foreign Relations Committee Chairman Bob Corker, R-Tenn., said in a statement Thursday night.
Initially, the White House sent mixed signals on its view of the legislation.
After first telling ABC's George Stephanopoulos on "This Week" on July 23 that Trump supports the bill, White House press secretary Sarah Sanders told reporters the next day that he "wants to make sure we get the best deal for the American people ... He's going to study that legislation and see what the final product looks like."
Just hours before the Senate voted, the answer was no clearer. "We continue to support strong sanctions against those three countries, and we're going to wait and see what that final legislation looks like and make a decision at that point," Sanders said at a White House press briefing.
But given the overwhelming majorities that approved the sanctions in Congress and the intense scrutiny of Trump's ties to Russia, the administration chose to avoid a public backlash and an embarrassing override by Congress.
"He has now reviewed the final version and, based on its responsiveness to his negotiations, approves the bill and intends to sign it," Sanders said in a statement late on Friday.
ABC News' Mariam Khan and Ben Siegel contributed to this report.