Catalans voted on Sunday in a regional election which could serve as a barometer for the level of support for seceding from Spain.
According to a near-complete count of the ballots, the Socialists under Salvador Illa became the largest party, achieving 42 seats.
However, this is far from the 68 seats required for an absolute majority in the chamber. The Socialists will therefore need to win the support of other parties.
Meanwhile, separatist parties appear to have lost power in Catalonia. The four pro-independence parties, led by former regional president Carles Puigdemont's Junts party, were set to win a total of 61 seats.
Sanchez hails 'historic result'
"Catalonia has decided to open a new era," Illa told supporters at his party headquarters. "Catalan voters have decided that the Socialist Party will lead this new era, and it is my intention to become Catalonia's next president."
Spain's Socialist Prime Minister Pedro Sanchez congratulated Illa for the "historic result." In a post on X, formerly Twitter, Sanchez said it would mark the beginning of "a new era in Catalonia."
Meanwhile, Puigdemont said his party had done well, but turnout among separatist voters remained low and without a strong showing by the other three parties, his options were limited.
Catalonian elections: Exit polls show no outright winner: journalist Stephen Burgen
What else do we know about the election?
"My sense today is that we are entering a new important stage in Catalonia," Illa said before casting his ballot.
Junts candidate Carles Puigdemont, who led Catalonia during a 2017 independence referendum that was declared illegal by the constitutional court, hopes to return to power and come back to Spain.
Following the independence vote, Puigdemont fled to Belgium and hopes to return home after Spain's government under Pedro Sanchez's Socialist government championed a bill that would grant amnesty to people involved in the secession vote. The bill is expected to come into effect by late May.
Sanchez hopes for regional victory
The Socialists winning the regional election in Catalonia would represent a substantial victory for Sanchez, who has promised to "heal the wounds" caused by the referendum and the subsequent judicial action.
The push for Madrid to reconcile with Catalan separatists has been bitterly opposed by the Spanish right and far-right.
Last month, Sanchez took a five-day break from office to consider resigning after what he called a smear campaign against his wife, who had been accused of corruption.
So far both Junts and the Republican Left of Catalonia (ERC), another pro-Catalan independence party, have ruled out forming a coalition with the Socialists.
The ERC under Pere Aragones currently governs in coalition with Junts.
If negotiations fail to produce a viable coalition by August, another election will be held in October.
sdi,dh/jsi (AFP, AP, Reuters)