The Senate on Thursday passed historic legislation that would bar employers from discrimination against workers based on their sexual orientation, although the bill faces an uncertain future in the Republican-controlled House.

The Employment Non-Discrimination Act passed 64-32, with 10 Republicans joining Democrats to support the measure.

Sen. Jeff Flake, R-Ariz., said voting for the bill "was the right thing to do."

"One of the most important constitutionally mandated functions of the federal government is to protect the rights of individuals," he said. "I am hopeful that the bill moves forward in a way that works for employers as well as employees."

President Obama applauded the Senate's action, saying it has the overwhelming support of the American people, "including a majority of Republican voters, as well as many corporations, small businesses and faith communities."

"They recognize that our country will be more just and more prosperous when we harness the God-given talents of every individual," the president said.

But House Speaker John Boehner, R-Ohio, has said his chamber won't take up the measure on the grounds it would increase the number of lawsuits against employers and hurt small businesses.

Democrats have pounced on the House GOP's position, accusing them of being "on the wrong side of history."

"The House Republican leadership continues to stand in the way of progress," said House Minority Leader Nancy Pelosi, D-Calif. "After spending $2.3 million in taxpayer funds on a losing battle to deny equality to LGBT families in our courts, House Republicans find themselves on the wrong side of history once again."

The president has urged the House Republican leadership to bring the bill to the floor for a vote and "send it to my desk so I can sign it into law."

Federal law prohibits discrimination on the basis of sex, race and national origin. But it doesn't stop an employer from firing or refusing to hire workers because they are gay, lesbian, bisexual or transgender.

The bill would bar employers with 15 or more workers from using a person's sexual orientation or gender identity as the basis for making employment decisions, including hiring, firing, compensation or promotion. It makes exemptions for religious institutions and the military.

The Senate also approved an amendment from Republican Sens. Rob Portman of Ohio and Kelly Ayotte of New Hampshire that would prevent federal, state and local governments from retaliating against religious groups that are exempt from the law.

The bill's backers say the nation's attitudes have grown increasingly tolerant and supportive of gay, lesbian, bisexual and transgender rights in recent years. They also point to the Supreme Court's ruling in June that affirmed the legality of gay marriage as proof the bill is in step with public sentiment.

But conservative groups, including Heritage Action, lobbied hard against the bill, saying it threatens civil liberties, the free market, traditional marriage and moral culture.

The Senate rejected an amendment sponsored by Sen. Pat Toomey, R-Pa., that would have expanded the number of groups that are covered under the religious exemption. Opponents argued that it would undermine the core bill.

Toomey said that while he was disappointed in the outcome of his amendment, he voted for the bill's passage anyway "to help move the legislative process forward."

"I hope that — should the House consider this bill — it will move to improve and strengthen this measure so we can both advance equality in the workplace and protect religious liberty," he said.

Wire services contributed to this article.