Many other countries in the region have been slow to introduce new social reforms for LGBT people.
The Slovenian parliament on Tuesday passed an amendment allowing same-sex couples to marry and adopt after a constitutional court ruling made it the first country in Eastern Europe to do so.
The family law amendment was passed by 48 MPs, with 29 against and one abstaining.
Slovenia, which emerged from the break-up of Yugoslavia, is the first former communist country to endorse this reform in Europe, as most of its neighbours do not allow civil unions or same-sex marriages.
The government of Estonia came the closest in 2016 by agreeing to recognize same-sex unions created in other countries. Croatia, the Czech Republic, Hungary and Montenegro have laws establishing same-sex civil partnerships - and in Hungary, even talking about homosexuality in front of children has been punishable by a fine since the summer of 2021.
In July, Slovenia's highest court ruled that the law defining marriage as only between a man and a woman discriminated against gay and lesbian couples.
It suspended the contested articles with immediate effect and ordered parliament to amend the text within six months.
"With these changes, we are recognising the rights of same-sex couples that they should have had for a long time," State Secretary Simon Maljevac told MPs when presenting the amendment.
The main opposition party, the Slovenian Democratic Party, criticised the court's decision and organised several rallies against the new law.
"The best father will never replace a mother and vice versa," said SDS parliamentary group chairman Alenka Jeraj at the opening of the debate.