For the Spanish government, the calculation is simple. Spain is full of restive regions that want to go their own way: Catalonia and the Basque country in particular have strong independence movements. One argument that separatists in European countries use is that because the newly independent countries could join the EU, independence is a low cost, low risk step.
As far as I'm concerned secession movements are a dream come true for the European Union:
Consider this incentive to divide a feature of the European Union rather than a bug. The Brussels transnational elites will laugh all the way to their new undemocratic empire while the silly people atomize their once-influential nation-states into little ethnic theme parks.
Let the people have their postage stamps and flags, the EU overlords likely think! The power will lie in Brussels, and who will be large enough to stop them?
It will be interesting to see if the EU allows a mere nation like Spain to stop small pieces of Europe from joining the new European empire that the Brussels transnational elites are building.