The measure passed in the Slovenian Parliament by a 51-28 vote margin.
The Associated Press reported that thousands of people protested against the bill before the vote.
Slovenia’s anti-discrimination laws include sexual orientation.
Same-sex couples have been able to legally register their partnerships in the country since 2006.
A 2011 law extended many of the same rights that heterosexual couples receive through marriage to gays and lesbians. Slovenian voters the following year repealed the statute in a referendum.
Matej Knific and Mattej Valencic, co-founders of PinkWeek.eu, a website that promotes LGBT tourism in the former Yugoslav republic, described Tuesday’s vote to the Washington Blade as “a huge step.”
“It is a milestone in history,” they said.
ILGA-Europe Executive Director Evelyne Paradis also applauded the vote and Slovenian LGBT rights advocates.
“The tireless efforts of the LGBTI community and their allies in Slovenia have ensured that equality was the winner in last night’s vote,” she said. “They are providing us all with inspiration this morning.”
The measure awaits the signature of the country’s president, Borut Pahor.
Same-sex marriage gains traction in Europe
Same-sex couples are able to legally marry in Portugal, Spain, France, Belgium, the Netherlands, Luxembourg, England, Wales, Scotland, Iceland, Norway, Denmark and Sweden.
Finnish President Sauli Niinistö last month signed into law a bill that extends marriage rights to same-sex couples.
Members of a Swiss legislative committee on Feb. 20 overwhelmingly recommended the country allow gays and lesbians to legally marry. Irish voters in May will consider whether to allow gays and lesbians to legally marry in their country.
The constitutions of Croatia, Hungary and Latvia define marriage as between a man and a woman.
Macedonian lawmakers in January overwhelmingly approved a proposed constitutional amendment that would ban nuptials for gays and lesbians in the former Yugoslav republic. A Pope Francis-backed referendum that would have amended the Slovak Constitution to define marriage as between a man and a woman and banned gays and lesbians from adopting children failed last month because of insufficient voter turnout.