Leading Spanish dailies of all poitical hues agree that Sunday's election result is a shock punishment for the Popular Party government of Jose Maria Aznar in the wake of the Madrid bombings.
The rightist press which backed Mr Aznar's government believes it lost because it was falsely perceived to have manipulated the bombings for electoral advantage. These papers also acknowledge the unpopularity of Spanish involvement in the Iraq war.
Newspapers taking a more independent line or backing the socialists also see the Iraq war as a decisive factor in the election outcome.
For the pro-socialist El Pais, it is "a political upheaval" but "the political system and democracy have been strengthened by these elections".
It believes many voters who had previously abandoned it, had returned to the socialist party, and the Popular Party (PP) "suffered a disaster".
"Voters have savaged the politics of Jose Maria Aznar and his successor Mariano Rajoy has paid the price. The rupture of political dialogue with the nationalists, foreign policy and particularly the decision to take Spain into the Iraq war have all been soundly rejected by the electorate."
The independent El Mundo agrees that the vote is "punishment for Aznar for which Rajoy paid the price" and the PP "suffered an electoral debacle".
"Never in the history of democracy has a party with an absolute majority been forced into opposition."
El Mundo feels that the then government's "precipitate action" in blaming the Basque separatist group Eta for the Madrid bombings "caused many citizens to doubt its judgement".
"The growing likelihood of al-Qaeda involvement renewed the mistrust over Aznar's grave error in placing himself under the banner of Bush."
El Mundo praises the "style and fair play of [socialist leader Jose Luis Rodriguez] Zapatero which the electorate has come to appreciate".
"But he faces considerable challenges, like leading the fight against terrorism, retrieving a balance in foreign policy, giving an impulse to the regeneration of democracy, and responding to the demands of the Basques and the nationalists."
In an editorial headlined "Three days which changed Spain" the pro-PP daily ABC acknowledges the "legitimacy" of the vote while castigating what it views as "the most reprehensible exercise of manipulation and sectarianism which saw election day dawn with a democratic party under the cosh".
"The socialist party, the legitimate and clean winner of these elections, will need to reflect calmly on the cost of such practices."
It blames "those seeking to take advantage of the social turmoil" for making the PP government a scapegoat.
Response to terror
Another pro-PP daily, La Razon, congratulates the socialists, recognising the election as a "manifestation of democratic coexistence and a calm response to terrorism".
It also believes that a decisive factor in the socialist victory was "the perception among many voters that Jose Maria Aznar compromised us in an unjust war in Iraq in close alliance with the US".
La Razon argues that the election result leaves open a raft of possibilities for the socialists, including an alliance with a variety of nationalist parties, among them, the more radical Catalans.
"We hope that the new government knows how to rein in the radicals," is its parting plea.
BBC Monitoring, based in Caversham in southern England, selects and translates information from radio, television, press, news agencies and the Internet from 150 countries in more than 70 languages.