Portugal's parliament passed a bill Friday that would make the predominantly Catholic nation the sixth in Europe to permit gay marriage.
Conservative President Anibal Cavaco Silva is thought unlikely to veto the Socialist government's bill, which won the support of all left-of-center parties. His ratification would allow the first gay marriage ceremonies to take place in April — a month before Pope Benedict XVI is due on an official visit to Portugal.
Right-of-center parties opposed the change and sought a national referendum on the issue, but their proposal was rejected and the government's bill was passed by 125 votes to 99.
Gay rights campaigners applauded from the galleries, hugged and kissed outside the building and ate wedding cake.
"This law rights a wrong," Prime Minister Jose Socrates said in a speech to lawmakers, adding that it "simply ends pointless suffering."
Socrates said the measure is part of his effort to modernize Portugal where homosexuality was a crime until 1982. Two years ago his government lifted Portugal's ban on abortion, despite church opposition.
Gay marriage is currently permitted in Belgium, the Netherlands, Spain, Sweden and Norway. Canada, South Africa and six U.S. states also permit it.
The bill removes a reference in the current law to marriage being between two people of different sexes.
"It's a slight change to the law, it's true," Socrates, the prime minister, said. "But it is a very important and symbolic step towards fully ensuring respect for values that are essential in any democratic, open and tolerant society: the values of freedom, equality and non-discrimination."
Like neighboring Spain, which introduced same-sex marriages four years ago, Portugal is an overwhelmingly Roman Catholic country and previous efforts to introduce gay marriage ran into strong resistance from religious groups and conservative lawmakers.