With bipartisan support and a 61-36 vote, the Senate passed the Respect for Marriage Act, which codifies same-sex and interracial marriages.
Lawmakers moved forward with the vote Tuesday after securing essential Republican support during a procedural vote a day earlier.
It now heads back to the House where it is expected to be passed quickly and sent to the president's desk to be signed into law.
"By passing the bill, the Senate is sending a message that every senator needs to hear," said Senate Majority Leader Chuck Schumer, D-N.Y., ahead of the vote. "No matter who you are, or who you love, you too deserve dignity and equal treatment under the law."
The bill would require that all states recognize same-sex and interracial marriages performed in any other state. It would not require that states individually allow these marriages to be performed. The measure also would recognize these marriages for consideration of federal benefits such as Medicare and Social Security.
Amendments to the original House-passed bill, led by GOP negotiators Sens. Susan Collins, Thom Tillis and Rob Portman, make sure that nonprofit religious organizations are not required to help perform a same-sex marriage.
Earlier this month, 12 Republicans joined 50 Democrats in a vote that ended debate on the measure, avoiding a filibuster, and permitting the legislation to advance toward a final vote in the chamber.
It quickly became clear that there might be a critical mass of Senate Republicans willing to support the legislation, and party leaders held off scheduling a final vote to give negotiators time to find the deal, which they reached this week.
The measure was first born out of the House this summer following the Supreme Court's decision in Dobbs v. Jackson, which held that access to abortion was not a constitutional right. Marriage rights advocates and Democrats expressed concern that the reversal could call other decisions regarding civil liberties into question, including marriage equality.
In his concurring opinion of the Dobbs case, Justice Clarence Thomas made a point to say that the landmark 2015 case that legalized same-sex marriage, Obergefell v. Hodges, rests on the same legal principles that underscored Roe.
While no case challenging the right to marry has yet made it to the Supreme Court, advocates feared Thomas was setting the stage for Obergefell's reversal.
The legislative victory comes as a surprise. House Democrats brought up the legislation ahead of the election with little to no expectation that it would become law so quickly, but rather to put Republicans on record on a social issue that has the vast support of American society. A notable number of House Republicans joined with Democrats to pass the bill, ultimately forcing the Senate to act on legislation that Democratic leaders did not initially have on their fall agenda.
The bill now heads to President Biden, who as vice president publicly broke with then-President Barack Obama to voice support for same-sex marriage rights in 2012. Obama ultimately joined him.