Ecuador's highest court has approved same-sex marriage in a landmark ruling in the traditionally Catholic country.
The vote at the nine-member Constitutional Court came as they ruled on the lawsuits by two same-sex couples who wanted to get married.
Five voted in favour, arguing all people were equal. Four said the issue had to be debated in parliament.
In Latin America, Argentina, Brazil, Colombia and Uruguay have already legalised same-sex marriage.
The ruling in Ecuador follows a decision by the Inter-American Court on Human Rights which said countries should give same-sex couples the right to marry and comes as other countries in the region debate changing their laws.
One of the lawsuits was filed last year by Efraín Soria and Javier Benalcázar, who have been together for 12 years.
"I want to say hello to Javier, who is in Guayaquil: 'Honey, I love you'," Mr Soria told reporters in the capital, Quito, where the vote was held in a closed-door hearing.
Mr Soria, who is the head of the LGBT rights group Ecuadorean Equality Foundation, urged other gay people to stop hiding and "enjoy the happiness that comes from being equal, like anyone else".
Mr Benalcázar told Efe news agency that he felt "emotional after so much struggle".
Celebrations erupted in Quito and in Guayaquil, Ecuador's second-largest city, after the decision was announced on Wednesday.
"It means that Ecuador is more egalitarian... It recognises that human rights must be for all people without discrimination," said lawyer Christian Paula of the Patka Foundation, which represents several same-sex couples seeking to marry.
The Ecuadorean Federation of LGBTI Organisations also welcomed the "iconic step".
Ecuador's constitution defines marriage as the union between a man and a woman. The four dissenting judges argued that the National Assembly would have to debate the issue before any constitutional changes were made.
The Ecuadorean judges who approved it also said they sought to counter any kind of discrimination in a country where same-sex unions have been recognised since 2015.
The decisions by the Constitutional Court are "binding and mandatory" and Ecuadorean authorities are obliged to abide by them, Gustavo Medina, a former Supreme Court president, told AFP news agency.