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".