The Spanish Confederation for Bus Transport (Confebus) had brought the case against the French-founded company, which expanded to Spain in 2010 at the height of the economic crisis and has become hugely popular.
It argued that BlaBlaCar was in effect providing the services of a transport company and that this was unfair competition as ride-sharing - coupled with rail travel - had contributed to a drop in the number of people travelling by coach.
BlaBlaCar, though, insists it is not a transport firm but a social network that brings drivers and passengers together to share the costs of a trip, from which the firm takes a fee just like Airbnb does on each flat or house reservation.
In a ruling made public on Friday, a Madrid court said it had not found evidence of any unfair competition.
It argued that the drivers on the BlaBlaCar platform are not employed by the company, nor do they belong to another firm seeking to make a profit.
"They are individuals who offer their services on the platform of their own accord and at their own risk, looking for people who are interested in going on the same trip and paying," it said.
It concluded that these passengers were not paying any form of levy or service, but were merely paying for the cost of the trip.
The court acknowledged that some people on the platform may try and make a profit out of offering trips, but added these cases appeared to be "exceptional" and were not what BlaBlaCar aimed to do.
While Confebus can appeal the decision, this is nevertheless the first legal victory for the ride-sharing firm in Spain, where it has also been targeted by authorities in Madrid.
The regional government there has threatened to fine BlaBlaCar and two drivers for "transporting passengers without a licence," a first for the firm.
It claims that the two drivers overcharged ride sharers by asking for more than just a proportional share of petrol and road tolls, while BlaBlaCar says both deny the charges.
The group, which is now present in 22 countries and boasts more than 30 million users, has reported the case to the European Commission.