In two hours of passionate debate, Democrats supporting the measure urged their colleagues to make history, comparing the fight for legalization of same-sex marriage to battles for women’s suffrage and against racism.

“We can make a giant leap forward today in the fight against one of the last legalized barriers to equal rights,” said Sheila Y. Oliver, the Assembly speaker, whose voice broke at several points as she exhorted her colleagues to support the bill.

The State Senate passed a similar bill on Monday; the Assembly vote was the first time the Legislature united in endorsing same-sex marriage.

And the vote, passing 42 to 33, underscored how much opinion has shifted since two years ago, when the Senate rejected a similar bill. New York State legalized same-sex marriage last year, and this month Washington State did so. The bill passed on Thursday would make New Jersey the eighth state that allows gay and lesbian couples to marry.

But advocates for the bill in New Jersey face a new fight: trying to win enough votes to override the governor’s expected veto.

Mr. Christie is a rising star in the Republican Party, in which any politician with national ambitions must consider social conservatives who oppose same-sex marriage. After New Jersey Democrats, who control the Legislature, said they would make same-sex marriage a top priority this year, the governor proposed putting the issue to voters in a referendum in November.

On Thursday, Mr. Christie declared the Legislature’s action merely “an exercise in theater.”

“I’ve given them an alternative,” said Mr. Christie, who spent the day holding a news conference to announce that WrestleMania was coming to MetLife Stadium in 2013 and appearing at a fund-raiser for a Republican running for the United States Senate. “Put it on the ballot and let the people decide.”

Democrats have accused him of avoiding an issue that could hurt his national prospects, and said they would refuse to pass the legislation required to put a referendum on the ballot.

Mr. Christie has 45 days to veto the bill. If he does, the Democrats will have nearly two years to muster the two-thirds majority needed to override it.

“We’re going to take the time we need, assisted by a changing world,” said Steven Goldstein, the chairman of Garden State Equality, a gay rights group. “Look at how the world has changed from two years ago.”

While the measure in the Senate found only 14 votes in 2010, this week it passed with 24. Assembly Democrats said they would have had two more votes, from Republicans, if two members had not been on vacation. Four Democrats voted against the bill on Thursday, and no Republicans voted in favor.

Mr. Goldstein said his group’s budget this year was one-tenth what it was two years ago. National advocacy groups did not put as much money into the battle, disappointed over the failure of the legislation two years ago. Instead, he said, supporters will push their case in person, reminding legislators that same-sex couples are their relatives and friends.

The governor’s refusal to support same-sex marriage could also backfire, some noted.

“The meanness question is going to come out,” said Assemblyman Reed Gusciora of Mercer County, one of two openly gay members of the Legislature and the bill’s chief sponsor.

An override would be easier in the Senate, where it would need 27 votes; in the Assembly, it would require 54.

The debate on Thursday, however, reflected the shifting landscape. Several legislators who are leaders in black churches that oppose same-sex marriage spoke of agonizing over the legislation but ultimately deciding to support it.

“I came to the conclusion that the people sent me here from my district, here to protect what’s right,” Assemblywoman Cleopatra G. Tucker, a Democrat from Newark, said. “To protect the rights of everyone.”

Others echoed Assemblyman Louis Greenwald of Cherry Hill, the majority leader, saying that in 50 years, people will look back and wonder, “What was all the fuss about?”

Some said that there would be economic benefits in same-sex marriage, that weddings could mean $250 million in business for the state and 800 additional jobs. If the state does not pass it, they said, it risks losing residents and their tax revenue to New York, where same-sex marriage is legal.

Polls show that a slight majority of New Jersey voters support same-sex marriage. They also show that about the same percentage supports the governor’s idea of putting it on the ballot.

Democrats argue that same-sex marriage is a matter of civil rights, and that civil rights should not be subject to referendum. They note that the last time the state put a question of civil rights on the ballot, in 1915, the male voters of New Jersey declined to allow women the right to vote.

Democrats predict that a referendum would bring a flood of outside money from national groups opposed to same-sex marriage. It could also draw out conservative voters to lift the hopes of the Republican presidential nominee in a state that would otherwise be expected to tilt toward President Obama.

In speeches on Thursday, Republicans argued that the decision to change an institution as sacred as marriage was better made by voters than by the 121 members of the Legislature.

“I trust the people of New Jersey and I believe they should be allowed to voice their opinion in a vote,” said Assemblywoman Nancy F. Munoz of Summit.

As she spoke, a crowd, largely of Orthodox Jewish men in the balcony sprang to its feet and cheered.

The question of same-sex marriage continues to make its way through the state’s courts. In 2006, the State Supreme Court ruled that same-sex couples were entitled to the same protections as heterosexual couples, but left it up to the Legislature to decide how to guarantee those rights. The Legislature passed a civil unions law, but seven gay couples have sued the state, arguing that the law discriminates against them in matters like obtaining a mortgage or seeing partners in the hospital.

Senator Loretta Weinberg, a sponsor of the legislation, said, “Our legislature stood up in both houses and stood up on behalf of marriage.”

This article, “Gay Marriage Bill Passed by NJ Legislature, Awaits Veto by Gov. Christie,” originally appeared in The New York Times.