Same-sex couples are to be given the same legal rights as married heterosexuals in Brazil following a landmark gay rights case.
The ruling sets a precedent for Latin America's biggest country, which has struggled with recent episodes of violence against the gay community.
With the world's largest population of Roman Catholics, the church in Brazil has argued against the decision, saying the only union the constitution referred to was that between a man and a woman.
However, Brazil's Federal Supreme Court voted 10 to zero in favour of civil partnerships for gay couples, with just one abstention.
Brazil now joins Argentina and Uruguay as one of the few South American nations to grant homosexuals civil partnerships, with inheritance and pension rights.
The move was celebrated by gay activists, as judges argued that the constitution did not explicitly rule out gay partnerships and that these were an expression of the right to privacy and equality before the law.
"The degree of civilisation of a country can be measured by the way people in a nation treat their homosexual community," newspaper O Globo's website cited Claudio Nascimento, head of Rio de Janeiro state's Gay, Lesbian and Transsexuals Committee, as saying. "It's a historic day for Brazil."
The degree of civilisation of a country can be measured by the way people in a nation treat their homosexual community. Claudio Nascimento
Some lawyers say the move could pave the way for gay couples to gain the right to adopt children.
The case was brought to the court by the government of Rio de Janeiro state and by federal public prosecutors.
Church leaders however upheld their objection to the ruling. "Plurality has its limits," Hugo Jose de Oliveira, a lawyer representing the Brazilian National Bishops Conference, or CNBB, told the court.
Around 140 million of Brazil's 190 million population in 2008 were Roman Catholic.
Most major cities in Brazil have an active and open gay community, with Sao Paulo hosting the world's largest gay parade every year, attracting three million people.
Yet the gay community has been openly harassed and beaten in central points in Sao Paulo and elsewhere in rural areas, and in the nation's capital Brasilia gay people are often ridiculed.