The Socialist Party was heading for victory in Spain’s European election on Sunday night as the far-right Vox won seats in the EU parliament for the first time.

Exit polls showed the Socialists increasing their share of seats compared to the last EU election, convincingly beating the conservative Popular Party (PP) into second place.

It was a poor night for the PP, which appeared to be on course to lose control of the Madrid region for the first time in a quarter of a century, in a local election there.

As well as the EU ballot, elections were held in 12 of Spain’s 17 regions and in towns and cities across the country, leading the day to be dubbed “Super Sunday”.

“Today we decide the future of Europe and of Spain for the next few years,” Socialist prime minister Pedro Sánchez tweeted early in the day before voting in Madrid.

Exit polls from the EU election echoed the swing to the left in Spain that was signalled by last month’s general election. Sánchez’s Socialists won that ballot, albeit without securing a parliamentary majority, handing the PP the heaviest defeat in its history.

Lost ground

Although the PP lost ground in the EU election, it managed to hold off the challenge of the Ciudadanos party, which has been attempting to assert itself as the main force on the right and the leading party of opposition. Exit polls showed that although it made substantial gains, Ciudadanos remained in third place, ahead of the leftist Unidas Podemos, which performed strongly after a disappointing general election.

As expected, Vox won seats in the EU parliament, scoring its third electoral coup in six months. In December, the far-right party led by Santiago Abascal won seats in the Andalucía parliament, before securing 24 seats in April’s general election.

Former Catalan president Carles Puigdemont: looks set to win a seat from self-imposed exile in Belgium. Photograph: Yves Herman/Reuters

Exit polls also showed that Catalan pro-independence parties won seats in the European election. Carles Puigdemont, candidate for the Together for Catalonia-Free for Europe (JxCat) ticket, fought a legal battle in order to be able to run from Belgium where he is in self-imposed exile and looked set to win a seat. This potentially opens the door to his return to Spain, given that he believes he will have parliamentary immunity.

Catalan independence

The leader of the Catalan Republican Left (ERC), Oriol Junqueras, who is in prison and facing trial for rebellion in the supreme court, was also on course to win a European seat. Both men are keen to use the EU parliament as a platform to carry the Catalan independence message to the international community.

In local elections, a hard-fought battle for control of Barcelona’s city hall saw mayor Ada Colau’s leftist Barcelona en Comú in a virtual tie with ERC candidate Ernest Maragall, as the Socialists made gains to take third place. Exit polls had former French prime minister Manuel Valls, running with the backing of Ciudadanos, vying for fourth place with the Catalan pro-independence JxCat.

In Madrid, leftist mayor Manuela Carmena looked to be on course to remain in power. In the Madrid region, parties on the left appeared to have enough seats to unseat the PP for the first time in 24 years.