Professor Clara Ponsati, a St Andrews University academic, was arrested in March after handing herself in to police in Scotland.
It came after she was made the subject of a European Arrest Warrant, with the authorities in Madrid seeking her on charges of violent rebellion and misappropriation of public funds over her role in Catalonia’s controversial independence referendum in 2017.
A full extradition hearing lasting four weeks was set to get under way in Edinburgh at the end of this month.
However, on Thursday, a Spanish Supreme Court judge dropped the extradition request for the 61-year-old, an ex-Catalan education minister.
It came after a German court ruled last week that former regional president Carles Puigdemont could not be sent back to Spain for rebellion, only for embezzlement connected to the alleged misuse of public funds for a referendum on secession.
The warrant was formally discharged during a short hearing on Monday at Edinburgh Sheriff Court.
Sheriff Nigel Ross told her: “As you know the arrest warrant from Spain has been withdrawn and therefore it just remains for me formally to discharge you from the European Arrest Warrant.
“You are free to go.”
Speaking outside the court, Prof Ponsati said: “I am just determined to keep fighting for the freedom of all political prisoners, for civil rights in Catalonia and Spain and for the Republic of Catalonia.”
In a statement, her solicitor Aamer Anwar added: “Today the arrest warrant for Clara was officially withdrawn.
“This is a humiliating defeat for the Spanish state which since October 1 has unleashed a wave of repression, attacking the Catalan people, suspending their government, jailing or trying to jail independence leaders.
“The Spanish state systematically used law as a weapon of war to try and eliminate their Catalan opponents, but they have persecuted not just politicians but also teachers, comedians, poets and rappers.
“The decapitation and liquidation of the Catalan Government was the sole purpose of the European Arrest Warrant as Spain twisted and broke the law but in court after court across Europe Spain’s reputation has been damaged and ultimately the warrants were withdrawn for the fear of failure.”
Join our Facebook group Our Edinburgh to share images and news from and around the Capital