The ruling said preventing such unions was unconstitutional and gives the state legislature six months to decide whether to amend current marriage laws or create a new framework for same-sex unions.
Gay rights activists welcomed the ruling as a victory, but traditionalists said the legislature was being held hostage to radical activists.
"Denying rights and benefits to committed same-sex couples that are statutorily given to their heterosexual counterparts violates the equal protection guarantee" of the constitution, the court said in its ruling.
It said that while it did not find that a fundamental right to same-sex marriage existed in the state, same-sex couples did not enjoy the same rights as their heterosexual counterparts.
All seven judges agreed that the lack of rights enjoyed by same-sex couples was unconstitutional, with four recommending that politicians deal with the issue, and the other three recommending gay marriages be approved directly.
Decision hailed
Jon Davidson, legal director of Lambda Legal, a gay rights law firm that represented the plaintiffs described the outcome as an exciting decision.
"It's an incredible move forward... We're hoping the legislature will allow same-sex couples to marry," he said, adding that polls suggested the state was ready to adopt such changes.
"It definitely is a move forward because at a minimum same sex couples in New Jersey are going to be provided equal rights and benefits, whether they are going to be provided marriage or not is something we'll see over the next six months."
"The drama moves to the legislature," he said, accusing the court of "passing the buck a little" in its decision.
Traditionalists outraged
Matt Daniels, president of the traditionalist Alliance for Marriage condemned the decision.
"This marks the second state -- after Vermont -- where radical activist groups have convinced state court judges to hold a gun to the head of the legislature," he said in a statement.
"The legislature will now be compelled to choose between two bullets – all under court order. Either they create so-called 'gay marriage' or they create a civil union scheme that is identical," he said.
"Most Americans believe that gays and lesbians have a right to live as they choose. But they don't believe they have a right to redefine marriage for our entire society."
The case was originally brought by seven gay and lesbian couples who applied for marriage licences in 2002 only be turned down.
They held that they should be allowed to marry under their rights granted by the state constitution.
Although the US Congress recently voted down a proposal for a constitutional amendment that would ban gay marriage, 45 of 50 states have laws that limit marriage as only between opposite-sex couples.
Massachusetts is the only US state that currently allows gay marriage while Vermont allows "civil unions" between same-sex couples.
