City councillors had voted to reduce the number of sexual entertainment venues (SEVs) in the city from the current four to zero from April.
Club owners took the council to court over the effective ban, questioning the legality of the move.
In a ruling Friday, the Court of Session ruled that the council’s decision to stop awarding the licences to adult entertainment venues was unlawful.
Lord Richardson said councillors had been given incorrect legal advice over the cap.
The council’s legal advice was that the council could award the licences on a discretionary basis, but lawyers for four venues in the city argued this effectively stopped them from operating.
Lord Richardson said: “I do not consider that the respondent [the council] has put forward a good reason why the erroneous decision should not be quashed”.
The United Sex Workers (USW) union had raised concerns the loss of licensed premises could force its members to work in unsafe and unregulated environments.
In a statement, it said: “The Council’s nil-cap decision, if upheld, would have resulted in the closure of all strip clubs in the city.
“This would have meant many of our members losing their livelihoods or having to move away from their homes and families to find work elsewhere.
“Not only is this a huge win for strippers in Edinburgh, who are no longer facing the prospect of forced mass-unemployment in the middle of a recession, but for the working rights of strippers across Britain.”
Steve MacDonald from the Club Operators Action Group, which brought the legal action, said it would work with council officials to continue providing “a proven safe working environment for all our staff members, customers and particularly our performers”.
The council’s regulatory committee originally voted by a majority of five to four for the effective ban, but its membership has changed since May’s local elections.
An Edinburgh Council spokesperson said it was aware of the ruling and was considering its next steps.