Estonia has become the first former Soviet republic to legalize same-sex partnerships.
In a narrow, 40-38 vote, parliament approved a civil partnership act that recognizes civil unions between couples regardless of gender.
Twenty-three lawmakers were absent or abstained in the third and final reading of the bill.
The law comes into force in 2016.
It allows same-sex couples to adopt the children of either partner but does not expressly grant them the right to adopt other children.
The Estonian Human Rights Center said it would send a strong message to neighboring Russia.
Russian President Vladimir Putin signed a law last year banning the spread of gay "propaganda" among minors, which critics say amounts to a ban on gay-rights rallies and encourages prejudice against homosexuals.
Now an EU member, Estonia chafed under Moscow's control for nearly half a century before the Soviet collapse of 1991.
Based on reporting by AP and RIA Novosti