It is a landmark court ruling that could have an impact on new online businesses across Europe.
The European Union's top court has ruled that Uber should be regulated like any other taxi service.
The company attempted to argue that it should only have to come under lighter rules for online businesses and not be classified as a transport service.
Barcelona taxi drivers behind the complaint to the European Court of Justice celebrated the ruling against Uber, which works with an app that lets passengers hail rides via their smartphones.
Spanish lawyer Montse Balague said: "The verdict makes it clear that the rules of the game are going to be the same for everyone when it comes to transport.
"Anyone who wants to transport a person from one point to another must comply with the state regulations in this regard."
It is a set-back for Uber but could have other consequences too.
Jakob Kucharczyk from the Computer and Communications Industry Association (CCIA) said: "From now on you are going to have online companies that potentially could be regulated under national rules and sectoral rules, rather than falling under European rules which were designed to make sure they can operate seamlessly across the internal market.
"So we are taking a step back from the digital single market, which is one of the key priorities in this Commission."
It is the latest in a series of legal battles for Uber, but the company says the ruling will not change things in most EU countries, saying it already operates under transportation law.