Gay marriage: Commons passes Cameron's plan
The House of Commons has voted to allow gay marriage in England and Wales, despite 161 MPs opposing the government's plans.
Several Tory MPs spoke against the proposals, which have caused tensions in the party, but the Labour and Lib Dem leaderships backed them.
The Marriage (Same Sex Couples) Bill now goes before the House of Lords.
David Cameron hopes it will become law soon, with the first ceremonies taking place by next summer.
The bill, if passed, will allow same-sex couples, who can currently hold civil ceremonies, to marry.
Religious organisations would have to "opt in" to offering weddings, with the Church of England and Church in Wales being banned in law from doing so.
Welsh Secretary David Jones and Environment Secretary Owen Paterson voted against the government's bill at its third reading. They were joined by 10 junior ministers.
Altogether 133 Tories opposed the bill, along with 15 Labour MPs, four Lib Dems, eight Democratic Unionists and an independent.
It goes to the House of Lords on Wednesday, where it is expected to generate further heated discussion.
Tensions between Downing Street and grassroots Conservatives, which have focused on the issue of Europe in recent weeks, have been exacerbated by the same-sex marriage proposals.
But Culture Secretary Maria Miler said it was an issue of equality, to which MPs had to show their "commitment".
For Labour, shadow home secretary Yvette Cooper said: "Let's celebrate, not discriminate. Let's put aside the anger and hear it for the joy."
Demonstrators against the plans held a vigil opposite the Palace of Westminster as the debate took place. A woman was detained by police after trying to drive a car through the gates of the Palace of Westminster as the vote took place.
The bill's third reading was backed by 366 MPs, giving it a majority of 205. There was a ripple of applause in the chamber after the result was announced.
The result is a marginal improvement for Mr Cameron on the vote at Monday's second reading, when 175 MPs opposed the plans.
They passed after ministers reached agreement with Labour's leadership.
Conservative critics had tabled a proposal to allow heterosexual couples enter into civil partnerships, if gay couples were allowed to get married.
But this was defeated, with MPs instead backing a Labour plan to consult on changing civil partnerships.
Many Tories are angry about comments reportedly made by Conservative co-chairman Lord Feldman.
He has denied calling activists "mad, swivel-eyed loons" and Mr Cameron has sent an email to party members, insisting they still shared a "deep and lasting friendship" with him.
Tory MP Brian Binley, who has led calls for an investigation into Lord Feldman's alleged comments, said there was a "growing gap" between the prime minister and the party.
And Robert Woollard, chairman of the Conservative Grass Roots organisation, suggested Mr Cameron needed to rein in some of his colleagues in No 10 who were "wet behind the ears" and "needed to get out more".