Spain set for political crisis as regional government election result spurs coalition on with plans for independence. Catalonian pro-independence supporters celebrate in Barcelona. Separatists took control of Catalonia's regional government on Sunday in an election result that could plunge Spain into one of its deepest political crises of recent years by forcing Madrid to confront an openly secessionist government at the helm of one of its wealthiest regions.

A record-breaking number of Catalans cast their vote in Sunday's election, billed as a de facto referendum on independence. With more than 98% of the votes counted, the nationalist coalition Junts pel Sí (Together for Yes) were projected to win 62 seats, while far-left pro-independence Popular Unity Candidacy, known in Spain as CUP, were set to gain 10 seats, meaning an alliance of the two parties could give secessionists an absolute majority in the region's 135-seat parliament.

"We won," the Catalan leader, Artur Mas, told a cheering crowd at a rally in Barcelona. "Today was a double victory – the yes side won, as did democracy," he added, as the jubilant crowd waved nationalist Estelada flags.

After attempts by Catalan leaders to hold a referendum on independence were blocked by the central government in Madrid, Mas sought to turn the elections into a de facto referendum, pledging to begin the process of breaking away from Spain if Junts pel Sí won a majority of seats.

His party fell six seats short of a majority on Sunday. But still, Mas claimed victory, vowing to push forward with independence. "We ask that the world recognise the victory of Catalonia and the victory of the yes," he said. "We have won and that gives us an enormous strength to push this project forward."

Junts pel Sí, representing parties from the left and right, as well as grassroots independence activists, captured 39.7% of the vote, while CUP received 8.2%. The result leaves the separatists with 47.9% of the vote, shy of the more than 50% that they would have needed if Sunday's vote had been a real referendum.

It's a result that will leave the movement struggling to gain legitimacy on the world stage, said political analyst Josep Ramoneda, while setting Madrid and Barcelona on course for a collision. "The government in Catalonia will try to move forward with independence, but this result won't allow them to take irreversible steps," he said, pointing to a declaration of independence as an example. "I mean, nobody will recognise that."

Catalonia goes to the polls in an 'incredible moment for democracy'

Instead, Catalonia will be left to face Madrid alone, who will seek to stymie any attempts to move forward with independence. The Spanish prime minister,Mariano Rajoy, has vowed to use the full power of the country's judiciary to block any move towards independence.

In recent years, Rajoy and his governing conservative People's party (PP) have refused to address underlying grievances over Catalonia's language and identity, as well as concerns that the region pays more in taxes than it receives in investments and transfers from Madrid. Instead, his party repeatedly turned to the country's constitutional court to shut down the process, backed by the Spanish constitution, which does not allow regions to unilaterally decide on sovereignty.

On Sunday, Catalans rebuffed the PP strategy in the region, giving them 11 seats, down from 19 seats in the previous elections and one of the party's poorest showings ever in the Catalan regional parliament. "These are not the results we expected or wanted," Xavier García Albiol, the PP leader in Catalonia said on Sunday.

The PP emerged as one of the election's biggest losers, said Emilio Sáenz-Francés, a professor of history and international relations at Madrid's Comillas Pontifical University. "This is a disastrous result for the PP." The result is a continuation of a downward trend for the PP, he added, pointing to May's regional and municipal elections, which saw them lose 2.5m votes.

Many Catalans opposed to independence instead turned to centre-right Ciutadans, the regional arm of Ciudadanos. The party more than doubled its number of elected officials from 2012, from 9 to 25, making them the second-strongest party in the new Catalan parliament. "They are constitutionalists with ideas that are much clearer than the PP," said Sáenz-Francés. "And above all, they have something that is extremely important right now in Spain, and that is new faces."

Rather than giving the separatists a strong mandate, Sunday's election simply reinforced that Spain has a problem, said Sáenz-Francés. "While the headline is not 'Catalonia votes in favour of independence and Spain breaks apart', it's rather 'Spain has to face the problem of Catalonia's integration'."

Whether or not Catalonia's newest parliament will be able to successfully address this issue may depend on whether Junts pel Sí, made up of forces from the left and right of the political spectrum, can find common ground with the far-left CUP.

CUP has said it favours moving forward with independence if separatists win a majority of seats and votes. They have also taken aim at the idea of Mas leading the transitional government, pointing to the austerity measures implemented by his centre-right government and hinting at the string of corruption scandals that have plagued his party, Democratic Convergence, in recent years.

On Sunday evening, CUP member Anna Gabriel said the independence project would continue, but noted that "Artur Mas isn't essential". CUP has also lobbied for a more immediate break with Spain, rather than the 18-month timeline charted by Junts pel Sí.

Any alliance with CUP may also modify the route to independence envisioned by Junts pel Sí. Mas has said the transitional government's first step would be a declaration, made within days of taking office, proclaiming the beginning of the process to break away from Spain. From there, the priority of the government would be to sit down with Madrid and European institutions to address issues such as the management of shared borders, the energy grid and the Ebro river basin.

The creation of state structures will also begin – from a diplomatic service to a central bank – to be ready in time for the proclamation of a new Catalan state. Plans for the first of these new state structures, a regional tax agency modelled on that of Sweden and Australia, was halted by Spain's constitutional court earlier this month after the court agreed to hear a challenge lodged by the central government in Madrid.

The same fate could befall many of the state structures envisioned by Mas. Last week, the Spanish prime minister said Madrid would continue to use the courts to block any move towards Catalan independence. "We would go to the constitutional court. And that's the way it is. Full stop," Rajoy told broadcaster Onda Cero.