With 98% of the vote counted, reportedly (WaPo today) 52% of the vote in Catalonia has gone for pro-union (with Spain) parties, while 48% has gone for pro-secession parties. However, apparently the pro-secession parties have won a solid majority in the parliament. This looks to me like last year's US presidential election, where Trump was elected while losing the popular vote.
I do not know what will happen there, nor do I have some nice neat recommendation for what they should do. Obviously the province is deeply and sharply and closely split over the secession issue. This election will not resolve it. Presumably the new government will push more for independence, but the central government, along with pretty much all of the EU and most of the rest of the world pushing back.
I am on record already expressing my own lack of sympathy for this movement. They gain credibility when the central government arrests their leaders and sends in police to beat and arrest demonstraters. But they already have language and educational autonomy. The main thing they seem to want is not to have their tax monies going to poorer regions of Spain. In this they resemblr the neo-fascist separatist parties of northern Italy, even as they invoke ant-fascism for their movement based on former Spanish history. I am not impressed.
I find all this to be sad as I like Catalonia and especially Barcelona. I worry that like so many other places that were doing well and now are not due to internal conflicts, this could happen there also.