The vote in the House of Representatives saw 39 Republicans join a united Democratic majority in a rare show of bipartisanship, provoking loud cheers on the floor less than 10 days after the Senate passed the same bill.
"Today, Congress took a critical step to ensure that Americans have the right to marry the person they love," Biden said in a statement.
He said the bipartisan vote would "give peace of mind to millions of same-sex and interracial couples who are now guaranteed the rights and protections to which they and their children are entitled."
The conservative-led Supreme Court in June overturned longstanding abortion rights, prompting lawmakers of both parties to move to prevent the court from taking away same-sex marriage rights, as some feared it might do.
The House had earlier approved legislation similar to the Senate's, but needed Thursday's vote to reconcile minor differences.
Biden has dubbed marriage equality one of his legislative priorities and has said he will "promptly and proudly" sign the bill into law.
Democrats and others saluted the historic vote.
"I began my career fighting for LGBTQ communities," outgoing House Speaker Nancy Pelosi tweeted on Thursday, "and now, one of the final bills that I will sign as Speaker will ensure the federal government never again stands in the way of marrying the person you love."
The new legislation, known as the Respect for Marriage Act, does not require states to legalize same-sex marriage but does require them to recognise a marriage so long as it was valid in the state where it was performed.
It repeals previous legislation defining marriage as a union between a man and a woman, and also protects interracial couples by requiring states to recognise legal marriages without regard to "sex, race, ethnicity or national origin."
Public acceptance of same-sex marriage has grown dramatically in recent decades, with polls now showing a strong majority of Americans supporting it.
But some conservatives and the religious right remain opposed.
"I think this is the wrong way to go," conservative Republican Jim Jordan said shortly before the vote.
House Democrats had worked with urgency to get the bill passed while they still control Congress. Republicans won a narrow majority in the chamber in midterm elections in November and will take control there in January, while Democrats retain narrow control of the Senate.
The Supreme Court in a 2015 decision legalized same-sex marriages. Hundreds of thousands of couples have married since then.
US-South Korean joint military exercises infuriate Pyongyang, which views them as rehearsals for an invasion and has...
Dogged by scandal in his later years, George Pell was the highest-ranking Catholic to be imprisoned for child sexual...
Beijing's growing assertiveness on Taiwan and its building of bases in disputed South China Sea have given fresh...
Adani's empire has lost more than $100 billion following explosive allegations of accounting fraud last week by US...
General Atomic Aeronautical Systems says it had been urging Washington for months to provide Ukraine its powerful Grey...
US central bank announces quarter-point hike to benchmark lending rate, taking the rate to a target range of...