Couples in civil partnerships will automatically be granted the status of married, officials said.
"Today we allow homosexual couples to enter into marriage on the same footing as any others -- something that Socialdemokraterne has fought for many years," Prime Minister Helle Thorning-Schmidt posted on Facebook.
The law does, however, allow priests to decline to marry same-sex couples in their churches, The Copenhagen Post reported.
"We are giving vicars the opportunity to say no. That's what's so fantastic about this proposal. On the one hand it allows same sex couples the opportunity to get married," Minister for Equality Manu Sareen said. "But at the same time we are reaching out to priests and saying that those who don't want to wed homosexual couples don't have to. We recognize that when dealing with theology you have to accept there will be different interpretations."
Not everyone is please with the law, though. The Kristendemokraterne Party, which holds no seats in Parliament, said the legislation restricts religious freedom and has threatened to sue the state.
"Parliament is infringing on religious freedom and in doing so violates the Constitution. That is why we are working on a lawsuit against the state to protect religious freedom and protect people who feel the law infringes their right to practice their faith," Kristendemokraterne Party Chairman Per Orum Jorgensen said.