It is the 11th European Union country to say yes to gay marriage.
The Slovenian Parliament has adopted by 51 to 28 votes a new law that authorises same-sex weddings.
Deputies have also voted in favour of legalising adoption by gay and lesbian couples.
There was a small protest outside the parliament as the vote took place, but recent polls showed that 60 per cent of citizens are in favour of gay marriage.
The bill now has to be signed into law by the country’s president.
Worldwide, Slovenia will become the 21st country to legalise gay marriage.
Congratulations to all our friends in Slovenia as they become the first post-communist country to legalize marriage equality! #MarRef— BeLonG To (@BeLonG_To) March 3, 2015
Slovenia passed equal marriage law in parliament. #pinkweek2015#ifeelsLOVEnia— PinkWeek.eu (@pinkweekeu) March 3, 2015
visitljubljana</a> <a href="https://twitter.com/Slovenia_in_UK">Slovenia_in_UKpic.twitter.com/sSil9VonBA