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.