PM Jose Socrates had appealed to MPs to back the same-sex marriage law
Portugal's parliament has passed a law to legalise same-sex marriage, but rejected proposals to allow homosexual couples to adopt.
The bill was approved with the support of the governing Socialist Party and other parties further to the left.
Prime Minister Jose Socrates opened the debate with an appeal to back the law, saying it would put right an injustice that had caused unnecessary pain.
The law has been fiercely opposed by conservatives in the Catholic country.
Rightist parties had sought a national referendum on the issue following a petition that collected more than 90,000 signatures, but their proposal was rejected.
Friday's debate was at times heated, says the BBC's Alison Roberts in Lisbon, with Socialists attacking as discriminatory a counter-proposal from the centre-right Social Democrats for a new so-called civil union for same-sex couples.
The bill will now be reviewed in committee before coming back for a final vote in parliament.
If the law is ratified by President Anibal Cavaco Silva, it could come into effect in April - just a month before a visit to Portugal by Pope Benedict XVI, a staunch opponent of gay marriage.
The ratification would make Portugal the sixth country in Europe to allow same-sex marriages after Belgium, the Netherlands, Spain, Sweden and Norway.
Many other countries have introduced civil partnerships, which give lesbian and gay couples some of the rights of married heterosexuals.