Spain faces political uncertainty after two new movements won nearly a third of the seats in the country's election.
Anti-austerity party Podemos and liberal Ciudadanos made big gains as the conservative Popular Party (PP) lost its majority.
"Spain is not going to be the same anymore and we are very happy," said Podemos leader Pablo Iglesias.
The PP and the Socialists had alternated running the government for more than three decades.
The parties must now embark on negotiations to form a coalition.
The PP had 28.72% of the vote, the Socialists 22.01%, Podemos 20.66% and Ciudadanos 13.93%.
Analysis: BBC's Tom Burridge in Madrid
The fact that the conservative PP came first with just 29% of the vote tells you how split this election was.
In reality the PP will struggle to find the necessary allies to form another government.
Podemos, an anti-austerity movement born during Spain's financial crisis, confirmed its position as a new, powerful political force.
It is possible it could form part of a left-wing alliance. Mathematically, such a coalition could reach power with the support of pro-independence Catalan parties.
But Spaniards could be guessing for days, or even weeks, about the shape and colour of their next Government.
After corruption scandals and austerity, the political landscape here has been dramatically changed.
PP leader Mariano Rajoy said he would try form a government, insisting: "This party is still the number one force in Spain."
But Mr Rajoy admitted that his party had taken some "difficult and even unpopular decisions" over the past four years as Spain struggled through an economic crisis.
Socialist leader Pedro Sanchez said his party was ready to start negotiations.
"Spain wants a move to the left," he said.
Many Spaniards are poorer now than they were at the time of the last election, fuelling the rise of Podemos.
Unemployment remains high at 21%, the second-highest rate in the EU after Greece, although it has fallen from its 2013 peak of 27%.
The economy, corruption allegations and a separatist drive in the prosperous north-eastern region of Catalonia were all dominant issues in the election.
Podemos claimed it won more votes than any other party in Catalonia and the Basque region and came second in Madrid.
"Many people have lost their confidence in traditional parties," said deputy leader Inigo Errejon. "The two-party system has ended."
Podemos's rise was also hailed by Greek Prime Minister Alexis Tspiras, whose Syriza party is its ally.
"Austerity has been politically defeated in Spain," said Mr Tsipras, adding that the result was a sign that "Europe is changing".
Albert Rivera, leader of the fourth-placed party Ciudadanos, meanwhile said the election marked a new era for young Spaniards like him, who were born after the country's dictatorship ended in 1975.
"Those of us who didn't experience the first democratic transition are experiencing a second one," he said.
Election turnout was 73.2% - up slightly compared to the 2011 election.
What happens next?
In line with the Spanish constitution, after talking to each party, King Felipe VI will nominate a candidate for prime minister. This cannot take place until after the new Congress holds its inaugural meeting on 13 January.
The nominee must then win a vote of confidence in parliament. If this fails, another candidate can be nominated and seek parliamentary approval.
If no administration can be formed within two months of the election, another must be held.
Doing the post-election sums:
- Grand coalition: Spain has never had a so-called grand coalition that would bring the Popular Party and the Socialists together
- Coalition of losers: The Socialists could link up with Podemos and Ciudadanos in a move that would echo the outcome of elections in Portugal last month
- Regional solution: The Socialists could also strike a deal with Podemos and smaller regional parties that won just a few seats each, thereby removing the need for a deal with Ciudadanos
Spain at a crossroads
Housing row in Catalonia: Taking back Barcelona's apartments
Depopulation in rural Castile and Leon: Resisting change in a dying village
Early school-leavers in Murcia: Spain's voters call for shake-up in classroom