Christian Democrats opposed the legislation.
The new legislation repeals a 1987 law that defines marriage as between a man and a woman. Sweden now joins the Netherlands, Belgium, Spain, Canada, South Africa and Norway in allowing same-sex marriage. In the United States, homosexual marriage is legal in Massachusetts and Connecticut.
The new law takes effect May 1 and allows individual pastors the freedom to opt out of marrying same-sex couples.
The Lutheran Church of Sweden has already expressed support for the new law, according to Agence France-Presse.
Since 2007, the Church – which 74 percent of Swedes are members of – has blessed civil unions for gay and lesbian couples but stopped short of blessing gay marriages.
The Lutheran Church synod is scheduled to decide in October whether or not to perform same-sex marriages, according to AFP.
Polls indicate that a majority of Swedes approve of homosexual marriage. The northern European country has recognized civil unions for homosexual couples since 1995.