The right-wing bloc which was expected to win, only secured 169 seats. The left-wing bloc won 153 seats - both falling far from an absolute majority.
Sunday's general election results in Spain have created uncertainty around the future of the next government - raising the spectre of political deadlock.
The leader of Spain's Populist Party, Alberto Núñez Feijóo, claimed victory in the snap vote, but cannot form a majority, even with the support of the far right.
Negotiations will now begin to try and form a new government and avoid another election.
Vox performs badly - down on seats from 2019 election
Feijóo's chances of forming PP forming a majority with the far-right Vox party were dashed after it achieved a worse result than in 2019.
On Sunday, the conservative leader said he would try to form a government.
“As the candidate of the party with the most votes, I believe it is my duty” to try to “form a government”, he said at the PP HQ in Madrid.
Incumbent Pedro Sánchez of the Socialist Worker's Party defied expectations, saying last night the "reactionary bloc has failed".
Supporters chanted "no pasarán" - the slogan of anti-fascist forces during the Spanish civil war meaning they shall not pass.
Sánchez must now hold on.
Whether Sánchez can find a way to keep his position as the head of Spain will depend on securing the backing of the Catalan pro-independence party, led by Junts de Carles Puigdemont.
They have previously warned they will not help without compensation.
Pedro Sanchez performed better than expected
Sanchez has been vindicated in his controversial decision to call the snap election during a fierce heatwave, after performing badly in local and regional elections.
With 94.97% of the votes counted, the conservative Populist Party obtained 136 seats, 47 more than 4 years ago. The far-right Vox party scored 33 seats - 19 less than in 2019 - which adds up to a total of 169 deputies in a coalition.
This figure does not allow them to govern, not even with the hypothetical contribution of the deputy of the Navarrese People's Union (UPN) and Coalición Canaria - due to the 176-seat threshold.
The left's bloc however scored 153 deputies. 122 of these deputies are from the PSOE and 31 from Sumar, the coalition of 15 parties of Yolanda Diaz.
To obtain the 176 seats Sanchez's party would need a total of 23 more deputies and their traditional allies in Parliament - ERC, Bildu, PNV and BNG (all regional parties) - together have 19 seats.
So the fate of Pedro Sánchez could be decided by what Junts de Carles Puigdemont.
The Catalan leader exiled in Belgium said before the beginning of the electoral campaign that his party would not support either Sánchez or Feijóo, so everything is still up in the air.
Left-wing leader Sánchez has been criticised in the past for making concessions to Catalan and Basque nationalists, which some say threaten the country's unity.
The surprising twist in events was the result of the left-wing nationalist EH Bildu which came close to becoming the first party in the Basque Country - while the ERC stands as the big loser of the elections, dropping to seven seats.
Most likely outcome is a new election
With these results, there will be a deadlock in Parliament. For the time being, this will allow Pedro Sánchez to remain in Moncloa - but could lead to new elections soon.