Dozens of Republicans have sided with Democrats in the US House of Representatives to pass a bill that would boost legal protections for same-sex marriages.
Democrats have suggested the US Supreme Court could roll back gay marriage rights, but some Republican critics dismissed the bill as a gimmick.
America's high court legalised same-sex marriage nationwide in 2015.
But last month it quashed a long-held constitutional right to abortion.
Prospects for the Respect for Marriage Act look less certain in the finely balanced Senate.
Some 47 Republicans joined all Democrats in voting for the measure by 267-157 on Tuesday after Republican leaders allowed party members to vote with their conscience.
More than three quarters of House Republicans opposed the bill on an issue that has long been a political purity test for social conservatives.
Critics warned the vote was a Democratic trap to force Republicans on the record with midterm elections looming in November.
Congressman Jim Jordan of Ohio said: "We are here for a political charade."
Republican Minority Leader Kevin McCarthy and Minority Whip Steve Scalise voted against it, but number three House Republican Elise Stefanik voted in favour.
Also voting yes was prominent Republican Liz Cheney, whose past opposition to same-sex marriage once caused a rift with her gay sister.
The bill would also provide legal protections for interracial marriages.
Democrats put the bill forward after the conservative majority on the Supreme Court in June overturned the 1973 Roe v Wade ruling that had guaranteed a constitutional right to abortion.
Conservative Justice Clarence Thomas wrote in his concurring opinion last month that other rulings on matters such as same-sex marriage and contraception should be reconsidered.
But Justice Samuel Alito, another conservative, specified in his ruling that "this decision concerns the constitutional right to abortion and no other right".
Republicans have poured scorn on Democratic claims that interracial marriage could now be threatened, pointing out that Justice Thomas is a black man married to a white woman.
Senate Democratic leader Chuck Schumer said on Tuesday: "Let's face it: This is a Maga Supreme Court. A Maga, right-wing extremist Supreme Court." Maga is short for "Make America Great Again", a slogan used by former President Donald Trump in his successful 2016 election campaign.
Mr Schumer did not commit to bringing the Respect for Marriage Act to a vote in the upper chamber of Congress.
Tuesday's roll call underscored how far the US has come on the once deeply polarising issue of gay marriage, just 14 years after Barack Obama, a Democrat, ran for the White House declaring marriage to be the union of a man and a woman.
A Gallup poll in June showed increasing support for same-sex marriage, with 70% of American adults backing such unions.