The National Court said in its ruling that allowing the strike to go ahead would “prevent the conclusion of the championship” and would “cause a serious organisational disorder”.
The AFE players' union announced last week that footballers would go on strike indefinitely from and the league, which controls clubs in the top two divisions, filed a petition to have the action declared illegal.
The strike call threatened to halt the clash between Atletico Madrid and Barcelona which could seal the championship for Barca.
It would also have disrupted the last league matches on and the Spanish cup final on between Barcelona and Athletic Bilbao.
The league had warned that a stoppage could cost it €50 million ($56 million) per matchday in lost revenue.