Eight of Trump's fellow Republicans joined Democrats to pass the war powers resolution by 55-45. The measure would require Trump to remove U.S. troops engaged in hostilities against Iran unless Congress declares war or passes a specific authorization for the use of military force.
Trump has promised a veto, and there is not expected to be enough support to muster the two-thirds Senate supermajority to override. Fifty-three of the 100 senators are Republicans, who rarely break with the president.
Senators voted nearly along party lines a week ago to acquit Trump of impeachment charges, after an investigation and trial that underscored Washington's bitter partisan divides.
Opponents said the resolution's passage sent the wrong message.
"We need to send a message of firmness, and not weakness," said Senator Jim Risch, the Republican chairman of the Senate Foreign Relations Committee.
Democratic Senator Tim Kaine, author of the resolution, said the vote showed strength and reflected the importance of Congress weighing in on any decision to deploy troops.
Even if the Senate cannot override a veto, Kaine said the resolution's backers hoped it would influence Trump when it came to future military action, adding that the president cared about what the public thinks, if not the Senate.
"The bill getting to his desk is an indication that we're listening to our constituents, and we're telling him blundering into another war would be a bad idea," Kaine told a news conference after the vote.
The bill's supporters noted that they were gaining more support for efforts to take back Congress' authority to declare war. The Constitution gives that power to Congress, not the president, but presidents from both parties in recent decades have expanded the White House's authority to pursue military action without legislators' input.
Republican Senator Todd Young, who voted for the resolution, said it should not have been necessary, but Congress had for years "attempted to pass the buck" to the president when decisions about military action had to be made.
"It's time to do our job," Young said in a statement explaining his vote that also praised Trump's leadership.
In June, another resolution that would have required Trump to get Congress' permission before striking Iran failed in the Senate.
Congress in July failed to override Trump's veto of legislation opposing the president's declaration of an emergency to allow the sale of billions of dollars worth of weapons to Saudi Arabia, despite lawmakers objections.