Mayor Michael Bloomberg's anti-obesity initiative had been scheduled to take effect Tuesday.
State Supreme Court Justice Milton A. Tingling Jr. called the ruling "arbitrary and capricious," The New York Times reported.
"It applies to some but not all food establishments in the city," Justice Tingling said in his written decision. "It excludes other beverages that have significantly higher concentrations of sugar sweeteners and/or calories."
He also ridiculed the idea consumers could receive refills as long as the cup was no larger than 16 ounces since that defeats the size restriction.
Restaurants, street carts and coffee venues spent the weekend preparing for the new regulation, which bans sale of sugar-enhanced drinks in large containers, CBS News reported Monday.
The regulation applied to sugary drinks, both bottled and fountain varieties, but exempted grocery or convenience stores that do not serve prepared foods. It also did not apply to diet sodas, other calorie-free drinks or any drink that is at least 50 percent milk.
New Yorkers are divided on the issue, a Quinnipiac University Polling Institute survey released last week indicated, showing 46 percent approved of the law and 51 percent opposed it.
The Bloomberg administration said it would appeal, the Times said.