A majority in Brazil’s Supreme Court has voted in favour of making homophobia and transphobia crimes.
Six out of 11 judges voted to consider discrimination against gays and transgender people equivalent to racism.
The decision will give the community, which suffers constant attacks, real protection, activists say.
At least 141 LGBT people have been killed in Brazil this year, according to rights group Grupo Gay da Bahia.
The Catholic Church and the evangelical movement are frequently critical of gay rights and far-right President Jair Bolsonaro, elected last year with strong support of conservative voters, is a self-described homophobic.
- Is the honeymoon period over for Bolsonaro?
- How Brazil’s culture wars are being waged in classrooms
The decision at the Supreme Court is not yet final and the next session to debate the issue has been scheduled for 5 June.
“Homophobic crimes are as alarming as physical violence,” Supreme Court Vice-President Luiz Fux said on his vote, citing “epidemic levels of homophobic violence”.
Brazil has the world’s biggest Catholic population but also a growing number of young, educated urban liberals who are eager to fight for gay and trans rights, correspondents say.
The country legalised same-sex marriage in 2013 and LGBT couples have also been given the right to adopt.
Last year, 420 LGBT people were killed across Brazil, one of the most violent countries in the world, according to Grupo Gay da Bahia.
Some activists have raised concerns over the possibility of a rise in crimes against gays and transgender people with the election of Mr Bolsonaro, a deeply divisive figure who has also made racist and misogynist remarks.
In previous interviews, he has said he would rather have a dead son than a homosexual son. Last month, he was heavily criticised for saying Brazil should not become a “gay tourism paradise”.