Uber, which is based in San Francisco, said in a statement Tuesday that the Madrid judge’s ruling was “inconsistent with broad political acknowledgment in Spain and across the European Union on the benefits of sharing economy services.'’

“We’ll defend ourselves in anyway we can legally,” Susanne Elias-Stulemeijer, an Uber spokeswoman in London added in a phone interview. She said that the company had yet to be contacted by the Spanish judge. “But first we need to see the official document."

Uber is the most visible of a number of companies that are using smartphone technology to reinvent the taxi business. Clients use the app to hail a ride from ordinary car owners who have signed up to shuttle passengers.

The nascent service has grown at a phenomenal rate, and done so with virtually no regulation. But its success — the company has been valued by investors at an eye-popping $40 billion and before the recent problems was operating in more than 200 cities around the world — has put Uber in the sights of public officials on various continents, sometimes because of resistance from entrenched operators, and sometimes because of concerns about the service’s approach to labor and safety rules.

The company has even run into resistance on its home turf of the United States, one of the most freewheeling markets for disruptive technologies. On Monday, the city government of Portland, Ore., said it would sue to stop the company from operating.