Barcelona fans will now be allowed to bring pro-Catalan independence flags to Sunday's Copa del Rey final with Sevilla.
Supporters had planned to have Scotland flags at the Vicente Calderon after the government's representative in Madrid decided not to allow Estelada flags for "operational and security reasons".
But a Madrid judge has overruled that decision after Barcelona appealed.
The club had said it was "an attack on the freedom of expression".
After the flag was banned, Catalan nationalist organisations had decided to hand out 10,000 Scottish Saltires at the Madrid final.
"We've chosen this symbol because it highlights the different treatment that Catalonia receives from Spain, compared with the UK government's treatment of Scotland," a group of bodies said in a statement.
Barcelona released a statement following Friday's new ruling.
"The club celebrates that the judge's decision will allow the free expression of legal symbols and banners by its members and supporters," it read.
"At the same time, FC Barcelona expresses its concern about the reoccurrence of situations like the one on Wednesday, and which are an affront to the freedom of expression, and do nothing to benefit what has always been a celebration of football and sport."
Carles Puigdemont, President of the Generalitat of Catalonia, tweeted that he will now attend the game following the decision being overruled.