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.
At least 158 people have died in Spain's worst flooding disaster in generations. On October…
Google has been fined two undecillion (a two followed by 36 zeroes) roubles by a…
Embarking on a home remodel is an exciting journey, promising enhanced comfort, increased property value,…
The US presidential candidates continued to campaign across key swing states on October 20. Footage…
Elon Musk has said he will give away $1 million a day to a registered…
India and Canada have decided to expel their top envoys along with other diplomats as…