Denmark is the latest country to approve same-sex marriage.
The law was passed with an overwhelming majority in parliament, and also covers weddings in the Church of Denmark, the BBC reports.
In May this year, United States president Barack Obama announced his support of same-sex marriage, taking a clear stand on the issue for the first time.
Denmark was the first country to recognise civil partnerships of same-sex couples in 1989.
However, no further steps were taken under the previous centre-right government, while other countries have passed laws extending marriage to same-sex couples.
The bill put forward by Denmark's centre-left government was passed in an 85-24 vote on Thursday.
The legislation takes effect on 15 June.