U.S. District Judge William Skretny, sitting in Buffalo, ruled Tuesday most of the legislation is constitutional, the New York Times reported.
But he called the seven-round limit "an arbitrary restriction."
"Whether regulating firearms is wise or warranted is not a judicial question; it is a political one," the judge said.
The legislation was adopted in January 2013, weeks after 20 children and six staffers were killed at the Sandy Hook Elementary School in Newtown, Conn. Among other provisions, the law banned the Bushmaster assault rifle and 30-round magazine Adam Lanza used at Sandy Hook.
Skretny said a law pushed by Gov. Andrew Cuomo does not violate the Second Amendment. He said the legislation "applies only to a subset of firearms with characteristics New York state has determined to be particularly dangerous and unnecessary for self-defense; it does not totally disarm New York's citizens; and it does not meaningfully jeopardize their right to self-defense."
Thomas H. King, president of the New York State Rifle and Pistol Association, said the legal fight is not over.
The association was one of the organizations involved in the legal challenge.
"Right from Day 1, I've been telling people that this is the first step," he said. "This is going to the Supreme Court."
LGBT community has 'bullied the American people': Bachmann
Ohio bar shooting arrested, charged with murder