Ride-hailing companies Uber and Lyft must classify their drivers as employees rather than freelancers, a judge in California has ruled.
The firms have 10 days to appeal against a preliminary injunction.
The work status is controversial. Gig economy firms say it means drivers can work on their own terms, while critics say they have no protection.
A new rule in California called Assembly B5 entitles gig economy workers to holiday and sick pay.
It came into force on 1 January and sets three criteria for defining whether a worker is independent or an employee.
These are listed on the California state government website and include whether the "hiring entity" has control and direction over workers in terms of their performance, and whether the jobs offered are different from the company's main line of work.
Uber and Lyft had argued that they should not be considered "hiring entities".
Judge Ethan Schulman disagreed, and said this contradicted claims the firms had made elsewhere.
"Defendants may not evade legislative mandates merely because their businesses are so large that they affect the lives of many thousands of people," he wrote.
An Uber spokeswoman said: "The vast majority of drivers want to work independently, and we've already made significant changes to our app to ensure that remains the case under California law."
Lyft said that drivers "do not want to be employees".
Media playback is unsupported on your device
The status of app-based drivers is set to be put to the vote in a referendum in California in November.
Mike Feuer, Los Angeles City Attorney, described the ruling as "a resounding victory" for drivers.