Just hours before California’s new gig-work law, AB5, is set to take effect, a federal judge issued a temporary restraining order blocking the state from enforcing it upon truck drivers.

U.S. District Judge Roger Benitez, in a five-page order on New Year’s Eve, discussed the California Trucking Association’s contention that AB5 was preempted by a 1994 federal statute that prohibits states from making laws that affect the price, route or service of freight-hauling motor carriers.

AB5, which becomes law on Wednesday, makes it much harder for companies to claim that workers are independent contractors. The trucking group filed a lawsuit in U.S. Distsrict Court for Southern California in November seeking a declaration that AB5’s strict employment test does not apply to the trucking industry.

A hearing on the trucking group’s request for a preliminary injunction is set for Jan. 13. Meanwhile, Benitez wrote, the plaintiffs “have carried their burden for purposes of emergency relief to show (1) that they are likely to succeed on the merits, (2) likely to suffer irreparable harm in the absence of relief, (3) that the balance of equities tips in their favor, and (4) that their requested relief is in the public interest.”

Independent owner-operator truck drivers, many of whom spent $150,000 or more on their big rigs, have been staging protests over AB5, saying that becoming employees would hurt them financially and remove the flexibility they prefer.

“AB5 threatens the livelihood of more than 70,000 independent truckers,” said CTA CEO Shawn Yadon in a statement in November. “The bill wrongfully restricts their ability to provide services as owner-operators and, therefore, runs afoul of federal law.”

AB5 author Assemblywoman Lorena Gonzalez, D-San Diego, said in a statement that she was undeterred.

“For decades, trucking companies have profited from misclassifying drivers as independent contractors, taking away rights such as meal and rest periods and fair pay,” she wrote. “We expect they will continue to invest resources in protecting their profits earned on the backs of workers, but we will continue to fight them at all levels to return jobs in the trucking industry to good, middle class careers.”

Carolyn Said is a San Francisco Chronicle staff writer. Email: csaid@sfchronicle.com Twitter: @csaid