The Spanish socialist party, led by Jose Luis Zapatero, has won the country's general election with the conservative Popular Party admitting defeat.
Voters appeared to have ignored concern over the slowing economy and soaring immigration and backed the party's liberal social reforms.
The socialists have fallen short of the number of seats needed for an absolute majority, so Mr Zapatero's party will probably have to find alliances with smaller regional parties to govern.
With 99.95% of votes counted, the Socialist Party is predicted to secure 169 seats, short of the 176 needed for an overall majority in the 350-member assembly, against 153 for the conservative opposition Popular Party (PP) of Mariano Rajoy.
In the last legislature, the Socialists had 164 seats and the PP 148.