The ruling could have a huge impact on the estimated 8 to 11 million American LGBT community, who are not protected against workplace discrimination in most US states.
The U.S. Supreme Court agreed that LGBT workers could not be sacked on the basis of their sexual orientation in a landmark ruling on Monday.
The 172-page ruling, which has been hailed by LGBT activists, came despite the appointment of two conservative judges under President Donald Trump and a general rollback of protections for lesbian, gay and transgender people by the White House since 2016.
The court voted by 6-3 that a key provision of the Civil Rights Act of 1964, known as Title VII, which bars job discrimination because of sex, includes bias against LGBT workers.
"An employer who fires an individual for being homosexual or transgender fires that person for traits or actions it would not have questioned in members of a different sex," Justice Neil Gorsuch, a Trump appointee, wrote.
"Sex plays a necessary and undisguisable role in the decision, exactly what Title VII forbids."
'Just the beginning'
Democratic presidential contender Joe Biden praised the court's decision on Twitter as "another step in our march toward equality for all.
"The Supreme Court has confirmed the simple but profoundly American idea that every human being should be treated with respect," he said.
The ruling was also welcomed by LGBT rights charities, including GLAAD.
"The Supreme Court's historic decision affirms what shouldn't have even been a debate: LGBTQ Americans should be able to work without fear of losing jobs because of who they are," GLAAD President and CEO Sarah Kate Ellis wrote on Twitter.
"The decision gives us hope that as a country we can unite for the common good and continue to fight for LGBTQ acceptance," she added.
The Silvia Rivera Law Project, a non-profit legal aid organisation helping transgender, intersex and/or gender non-conforming people, described the decision as "a major legal victory" but stressed that the "fight to create a world without workplace discrimination for trans people, disproportionately trans people of colour, goes on".
Chase Strangio, a lawyer for the American Civil Liberties Union (ACLU) non-profit, who represented Aimee Stephens, one of the plaintiffs who passed away last month, stressed that the ruling is "just the beginning we have so much to fight for".
"I am so grateful and proud and invigorated. And still full of rage and grief for those who did not live to see this, for those who did not live to see adulthood, for those who died because of state violence, fo those who died because of state neglect, for those who died because of interpersonal violence, he added.
Matter for 'Congress, not this Court'
Justice Brett Kavanaugh, another Trump appointee, was one of the three judges who dissented.
He argued that the court was rewriting the law by stretching the meaning of the word sex to include gender identity and sexual orientation and that the "responsibility to amend Title VII belongs to Congress and the President in the legislative process, not to this Court".
He conceded however that "it is appropriate to acknowledge the important victory achieved today by gay and lesbian Americans."
"They have exhibited extraordinary vision, tenacity, and grit — battling often steep odds in the legislative and judicial arenas, not to mention in their daily lives. They have advanced powerful policy arguments and can take pride in today's result," he added.
The ruling, delivered two weeks into Pride Month, comes three days after Trump reversed Obama-era healthcare protections for transgender people.
The Department for Health and Human Service (HHS) said in a statement that it was "returning to the government's interpretation of sex discrimination according to the plain meaning of the word "sex" as male or female and as determined by biology".
Several pending lawsuits regarding LGBT rights remain in the Supreme Court docket including cases about sex-segregated bathrooms and locker rooms and transgender athletes' participation in school sporting events.
Justice Gorsuch wrote, however, that "none of these other laws are before us; we have not had the benefit of adversarial testing abut the meaning of their terms, and we do not prejudge my such question today."