It is a significant victory for the President, Barack Obama, after the heads of all three uniformed services said that no decision should be taken until a review had been completed in December.
"This legislation will help make our armed forces even stronger and more inclusive by allowing gay and lesbian soldiers to serve honestly and with integrity," Mr Obama said.
There were cheers erupted in the House chamber after the vote to repeal the law, established as a compromise in 1993 during President Bill Clinton's administration. The vote came hours after the Senate Armed Services Committee took similar action.
"It's time for this policy to go, it doesn't reflect America's best values of equal opportunity," said Senator Joe Lieberman, an Independent, after the committee voted 16 to 12 for the repeal.
"With our military fighting two wars, why on Earth would we tell 13,500 able-bodied Americans that their service is not needed?" said Representative Patrick Murphy, a Democrat and the first Iraq war veteran to serve in Congress.
Joe Solmonese, president of the gay rights group Human Rights Campaign, said: "Lawmakers today stood on the right side of history." The British ban on gays serving openly in the armed forces was lifted in 2000.
SCROLL TO CONTINUE WITH CONTENT
Never Miss a Beat.
Get our best delivered to your inbox.
The vote in the House of Representative was won by 234 to 194. The White House had pushed for an early vote because of the strong likelihood that Democrats would lose seats in the House and Senate in the November midterm elections, ensuring that there would be enough votes to block the measure by the end of the year.
Senior Pentagon officials fear that the move will create dismay among servicemen and women because it prejudges the elaborate process of consultation announced just months ago. Robert Gates, the Pentagon Secretary, reluctantly backed the move.
Most Republicans voted against the plan."It's going to be very harmful to the morale and affect the battle effectiveness of our military," said Senator John McCain, the 208 Republican presidential nominee and a former US Navy captain.
Under the White House-backed compromise, Congress would vote now on lifting the ban but let the Pentagon decide when and how quickly to implement the repeal after completing its review.
The repeal will require certification from Mr Obama, Mr Gates and Admiral Mike Mullen, chairman of the Joint Chiefs of Staff and a supporter of abandoning the law, that it would not harm the military.