Passage of the Employment Non-Discrimination Act came despite protests from some gay rights supporters that the bill does not protect transgender workers. That term covers transsexuals, cross-dressers and others whose outward appearance does not match their gender at birth.
The measure would make it illegal for employers to make decisions about hiring, firing, promoting or paying an employee based on sexual orientation. It would exempt churches and the military.
After the 235-184 vote, supporters are expecting a tough fight in the narrowly divided Senate, where Democrat Edward Kennedy plans to introduce a similar version.
A veto from President George W. Bush is expected if the proposal does pass the Senate. The White House has cited constitutional concerns and said the proposal could trample religious rights.
Backers of the House bill proclaimed it a major civil rights advance for gays. "Bigotry and homophobia are sentiments that should never be allowed to permeate the American workplace," said House Majority Whip James Clyburn.
The decision by Democratic leaders to exclude protections based on gender identity created sharp divisions in the party and among gay rights activists.
Republicans, meanwhile, said the bill could undermine the rights of people who oppose homosexuality for religious reasons and lead to an onslaught of dubious discrimination lawsuits.
Protections for transgender workers were in the original bill. But Democratic leaders found they would lose support from moderate and conservative Democrats by including transgender employees in the final bill.
Rep. Barney Frank, one of two openly gay members of Congress and an important supporter of the bill, urged colleagues not to let the dispute over transgender workers doom an important gain in civil rights.
Frank said he hoped the bill would send a message to "millions of Americans who are gay and lesbian that they are not bad people, that it is not legitimate to fire them simply because of who they are."
He also pledged to continue to fight for a bill to protect transgender workers.
Job discrimination based on factors such as race, gender and religion are banned under federal law. Nineteen states and the District of Columbia have laws against sexual-orientation discrimination.
Only nine states specifically protect transgender people from discrimination: New Jersey, Minnesota, Rhode Island, New Mexico, California, Illinois, Maine, Hawaii, Washington. The District of Columbia has a similar law.
By January, laws also will be in effect in Iowa, Vermont, Colorado and Oregon.