London: Queen Elizabeth II gave her assent to the Same Sex Couples Bill here on Wednesday, officially legalising gay marriages in England and Wales.
The first same-sex marriages can now take place by mid-2014 after the new measures became law.
Under the terms of the bill, religious organisations will have to "opt in" to offer weddings, with the Church of England and Church in Wales being banned in law from doing so.
House of Commons Speaker John Bercow announced that the bill had received Royal Assent, the formal approval of the sovereign required for all legislation.
The news was greeted with cheers in the chamber.
Many MPs took to Twitter to say they were "delighted" with the news.
Earlier this week, peers gave their assent to the third reading of the government`s same-sex marriage bill without a formal vote after a short debate in the House of Lords.
They also backed plans for a review of pension arrangements for gay couples.
Commons MPs decided not to oppose a number of minor changes agreed by the Lords and approved the legislation yesterday.
Gay rights activists have vowed to press on for equal marriage in Britain`s other constituent nations Scotland and Northern Ireland.
Among opponents of the legislation, the Coalition for Marriage campaign group said it would mobilise a 700,000-strong support base against the redefinition of marriage.
Gay couples in Britain have had the right to enter into a civil partnership since 2005, giving them identical rights and responsibilities to straight couples in a civil marriage.
But campaigners point to some differences such as international recognition, which applies to marriage but not partnerships.
The passage of the bill brings an end to one of the most acrimonious debates of recent years which has divided the Conservative Party and at times, pitted the Church against the state.