The queen's approval was a formality and is the last step necessary for a bill to become law.
The law enables gay couples to get married in both civil and religious ceremonies in England and Wales, provided that the religious institution consents. The Church of England, the country's official faith, is barred from performing such ceremonies.
It also will allow couples who had previously entered into civil partnerships — which were introduced in 2005 and carry similar rights and responsibilities to marriage — to convert their relationships to marriage.
The British government introduced the bill in January.
Prime Minister David Cameron had backed it, but it divided his Conservative Party and touched off strident debates in the House of Commons and House of Lords.
Numerous attempts to derail the legislation failed as it wound its way through Parliament, with traditionalists arguing it would undermine the sanctity of marriage.
On Tuesday, Conservative lawmaker Gerald Howarth accused the government of having "bulldozed" the legislation through Parliament, "offending large swatches" of his party.
But in the same debate, shadow women and equalities minister Yvette Cooper said it was the "time to celebrate and not discriminate."