Democratic Gov. Jon Corzine said he would sign the measure, which would extend to same-sex couples all the rights and privileges available under state law to married people. The bill passed the Assembly 56-19 and the Senate 23-12.
New Jersey's Supreme Court ruled in October that same-sex couples are entitled to the same rights as heterosexuals in New Jersey, but that lawmakers must determine whether the state will honor gay marriage or some other form of civil union.
Advocates on both sides of the issue had believed the relatively liberal New Jersey high court had the best chance of approving gay marriages since Massachusetts became the only state to do so in 2003.
But the high court stopped short of fully approving gay marriage in the state — it had given lawmakers 180 days to rewrite marriage laws to either include same-sex couples or create new civil unions.
"Although we cannot find that a fundamental right to same-sex marriage exists in this state, the unequal dispensation of rights and benefits to committed same-sex partners can no longer be tolerated under our state Constitution," Justice Barry T. Albin wrote for the 4-3 majority's decision.
Gay couples in New Jersey can already apply for domestic partnerships under a law the Legislature passed in 2004 giving gay couples some benefits of marriage, such as the right to inherit possessions if there is no will and health care coverage for state workers.
"The issue is not about the transformation of the traditional definition of marriage, but about the unequal dispensation of benefits and privileges to one of two similarly situated classes of people," the court said in its 4-3 October ruling.
Cases similar to New Jersey's are pending in California, Connecticut, Iowa and Maryland.
Until this ruling, gay marriage supporters had a two-year losing streak, striking out in state courts in New York and Washington state and in ballot boxes in 15 states where constitutions have been amended to ban same-sex unions.