Singapore's parliament has decriminalised sex between men, but amended the constitution to effectively block full marriage equality.
The British colonial-era law penalised sex between men with up to two years in jail, although the statute was not actively enforced.
The law had long been criticised as discriminatory and stigmatising to the LGBTQ community.
The move follows several failed attempts to have the legislation repealed in the courts.
"I feel grateful and privileged to have witnessed the endpoint in our 12-year-long struggle to strike down Section 377A," said Roy Tan, a medical doctor who was one of those who had unsuccessfully challenged the law in court.
He described the repeal as "the birth of a new chapter in the history of Singapore's LGBT community".
"With the law repealed, we can progressively dismantle impediments to the visibility and progress of queer citizens because there no longer remains a reason for prejudicial treatment," he added.
"I am happy that it had finally happened," a member of the LGBTQ community who wanted to be known only by his first name Justin told AFP.
"One less reason for me to hide my true self, because of some archaic law. But this is just the first step to remove the social and religious stigma that has been upon the community because of outdated beliefs, and media censorship."
However, parliament also passed a constitutional amendment bolstering the existing definition of marriage as between a man and a woman, essentially closing the door on future legal challenges that could establish equal marital rights for LGBTQ people.
Law Minister K Shanmugam said at the end of the debates that repealing the law was "the right thing do to because there are no public concerns that justify private consensual sex between men being a crime."
He had said yesterday that law had been a "daily reminder" to gay men that "every time he engages in private sexual activity behind closed doors, in the sanctity of his bedroom, he is nevertheless a criminal".
Singapore is a wealthy international business hub but social attitudes remain deeply conservative.
Rights groups have said the city-state's decriminalisation of sex between men falls short of protecting the LGBTQ community.
Several attempts to have the courts overturn Section 377A on constitutional grounds failed in recent years.
Critics argued that the legislation contradicted constitutional guarantees of equal treatment under the law.
Without the constitutional amendment, Mr Shanmugam argued there was a risk that the courts could strike down Section 377A in the future.
This would have left the traditional structure of marriage vulnerable to legal challenge as well, he said, adding that if that happened, it will have endangered all government policies based on that definition.
LGBTQ rights advocates have said they oppose any further laws and constitutional changes to protect the traditional definition of marriage because it would promote unequal treatment.
Minister for Social and Family Development Masagos Zulkifli, whose office tabled the constitutional amendment, said the traditional definition of family was the bedrock of society.
"There is no plan to change this definition to include same-sex marriages," he said today.
"Religious leaders or any licensed solemniser for that matter cannot solemnise a same-sex couple. This is against the law."
Mr Masagos said, however, that future parliaments could change the definition of marriage.
Homosexuality is banned in 69 countries, including 11 where it is punishable by death, according to a 2020 report by the International Lesbian, Gay, Bisexual, Trans and Intersex Association (ILGA).