Opponents of gay marriage suffered a significant setback on Tuesday night when peers from across the House of Lords overwhelmingly defeated an attempt to kill the parliamentary bill equalising marriage.

Campaigners for same-sex marriage hailed the result after a wrecking amendment, tabled by the former West Midlands chief constable, Lord Dear, was defeated by 390 to 148 votes, a majority of 242.

Ben Summerskill, the chief executive of Stonewall, said: "We always expected a tough challenge in the House of Lords, and Lord Dear's 'fatal motion' – very rarely used – demonstrates the lengths to which a minority of peers are, sadly, still prepared to go to deny full equality to lesbian, gay and bisexual people."

But opponents of the bill vowed to continue their fight against the marriage (same-sex couples) bill, which now moves to line-by-line examination at its committee stage in the Lords. Colin Hart, campaign director for the Coalition for Marriage, warned the government that peers would be prepared to vote down the bill at its third reading in the Lords unless further safeguards are introduced.

Hart said: "The government may have won the vote today, but what was clear from the debate was the huge opposition to almost every part of the bill. We will continue to campaign to save traditional marriage and today's vote and the concerns expressed by many peers mean we will be able to introduce safeguards that will protect teachers, registrars, chaplains and anyone who works in the public sector. And if the government refuse to accept these changes, they risk losing the legislation at third reading."

Hart issued his warning after Baroness Stowell of Beeston, the government whip in charge of the bill in the Lords, indicated that ministers are prepared to make further concessions to allay church fears that teachers may be forced to promote gay marriage.

But the opponents of the bill appeared to have miscalculated, after peers lined up during the two-day debate to question Dear's tactics to try and kill the bill two weeks after it was approved overwhelmingly by MPs – 366 votes to 161 – at its Commons third reading. Peers tend not to hold a vote at a bill's second reading, as they did this time, because the constitutional role of the upper house is to revise legislation.

Baroness Noakes, the Tory peer, told the Lords: "I hope we will respect the clear decision of the other place on a free vote. We can then move on to the job we are good at, as a revising chamber, testing all the detailed concerns that have rightly been raised by noble lords in this debate."

Dear put up a last-ditch bid to rally support for his wrecking amendment as he insisted that the vote in the Commons was rigged. "It is useful to remember that there was no proper consultation, there was no green paper, there was no white paper, there was no manifesto. There was no pre-legislative scrutiny."

"The government consultation procedure was, frankly, a mockery and the result was rigged. Whichever way you look at it, the vote there [in the consultation] was 83% against the bill. It was heavily constrained in its passage through the House of Commons with some serious doubts about the process."

Peers heard impassioned speeches during the two-day debate. Lord Dannatt, the former chief of the general staff, accused supporters of the bill of demanding peers abuse the democratic process – something he fought to protect over 40 years in the army. Dannatt told peers on Monday night: "Following due democratic process and procedure is a principle that I spent the 40 years of my professional life as a soldier upholding. We fought for the ballot box against the Armalite for 38 years in Northern Ireland; we stood for democracy against communism for 44 years in Europe; we stood for the democratic right of self-determination in the Falklands in 1982 and still do; and now as a parliamentarian I am asked to accept an abuse of the democratic process, and I will not do it."