But the Swiss themselves will have the final say on the matter as theChristian, ultra-conservative Federal Democratic Union party has announced that it will ask for the legislation to be put to a referendum.
Switzerland is one of few European countries where same-sex marriage is not legal.
The country allows same-sex couples to enter into “registered partnerships”, but this does not provide the same rights as marriage, including for obtaining citizenship and the joint adoption of children.
The two chambers of parliament have now approved the bill after multiple rounds of debate since 2013.
The wording of the bill allows gays and lesbians to marry and for lesbians to access sperm donations.
“This is a historic victory for the rights of the LGBTI* Community,” Amnesty Switzerland wrote in a tweet.
The Rainbow Families association, set up in 2010 to defend the interests of gay parents in Switzerland, said it was preparing for the issue to be put to a popular vote.
“If the opponents launch a referendum, we're ready,” said Matthias Erhardt, deputy president of the national committee especially set up on “marriage for all”.
“We have 82 percent of the population behind us and, thanks to the mobilisation of the LBGT community, our partner organisations and the political parties who support us, we will be able to further increase acceptance of LGBT people in society,” he said.