TRENTON, N.J.—A federal judge on Wednesday agreed to hold up New Jersey’s recent political donor disclosure law in response to a lawsuit brought by a think tank founded by the Koch brothers.

U.S. District Judge Brian Martinotti granted the preliminary injunction Wednesday after Americans for Prosperity sued earlier this year to block the law.

The...