Occasional clashes broke out between riot police and protesters as the large crowds pushed against police cordons, La Vanguardia reports.
In total, 25 separatist politicians will be tried for rebellion, embezzlement or disobedience, the judge said in a court ruling, upping the legal stakes in Madrid's response to separatists in the wealthy northeastern region.
The Catalan politicians face an array of charges ranging from misuse of public funds to rebellion, the most serious crime, which carries a maximum prison sentence of 30 years upon conviction.
Judge Llarena also issued an arrest warrant for Marta Rovira, the deputy head of the separatist Esquerra Republicana party, who failed to appear in court on Friday.
Spain's government has rejected a plan by separatists in Catalonia's regional parliament to elect prominent secessionist politician Jordi Turull as Catalan president. "It is not right for a judge to do politics", Mr Puigdemont said.
Catalonia declared independence from Spain in October 2017 after a political back-and-forth between the regional and national governments.
Demonstrations also took place in other parts of Catalonia.
Friday night's rallies had been organised by a separatist group before the court decisions were announced.
Judge Llarena is reactivating an arrest warrant that he dropped a year ago against Mr. Puigdemont and other former members of his cabinet, amid concerns that courts in Belgium, where he fled, would instead soften the charges against them.
Another, calmer, rally filled the huge Catalonia Square in central Barcelona.
The five join four other Catalan leaders already detained in prison. She said: "I start a hard road, that of exile", and is believed to be in Switzerland where Anna Gabriel is now living.
The semi-autonomous region has been without a leader for almost five months after central authorities took control following October's illegal independence declaration. The issue of independence not only has generated a conflict with Madrid but also has split Catalan society.
Parliament rules say he could have a second chance to be elected on Saturday, when only a simple majority of more "Yes" than "No" votes would be required to make him Catalonia's next president.
Mr. Turull was the third candidate proposed by the main separatist parties since December, when they narrowly retained their parliamentary majority in a snap election called by Mr. Rajoy.
But they have still not been able to form a government as their two previous candidates for the presidency proved problematic.