Anti-austerity 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%.
PP leader Mariano Rajoy said he would try form a government, insisting: “This party is still the number one force in Spain.”
However, Mariano 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.
Spain’s 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 PM Alexis Tspiras, whose Syriza party is its ally.
“Austerity has been politically defeated in Spain,” said Alexis 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.
In line with Spain’s 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 January 13.
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.
Image source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…