TALLINN, Estonia—Estonia’s parliament on Thursday approved a new law to recognize gay partnerships, making it the first former Soviet republic to green-light civil unions for same-sex couples.

Passed by a narrow 40-38 margin, the new law provides legal protections for unmarried couples living together, including same-sex partners. Ten lawmakers abstained from voting while 13 were absent from the 101-member parliament.

The...