The governing Socialist Party of Jose Luis Rodriguez Zapatero has claimed victory over the conservative Popular Party in Spain's general elections.
http://newsimg.bbc.co.uk/media/image..._getty203b.jpg
It remains unclear if the Socialists have secured the 176 seats needed for an absolute parliamentary majority.
With two-thirds of votes counted, the Socialists were projected to win 168 seats to 154 for Mariano Rajoy's PP.
"We can say with confidence that the Socialist Party has won," said party secretary Jose Blanco.
To the cheers of euphoric government supporters wielding flags in the Socialist red and white colours outside the party's Madrid headquarters, Mr Blanco said: "It is a great victory."
He added that Mr Zapatero was "in a better position to govern over the next four years and begin a new period of change and progress with a Socialist government".
But the BBC's Jonny Dymond in Madrid says activists are waiting to see how the vote count translates into seats.
Correspondents say the result may force the party to re-forge an uncomfortable alliance with smaller regional nationalist parties.
High turnout
The elections were marred by Friday's killing of the former Socialist councillor, Isaias Carrasco, in the Basque Country.
Police have blamed Basque separatists for the shooting, which brought election campaigning to an early close, but so far no group has claimed responsibility.
There had been a high turn-out before polling stations closed at 2000 (1900 GMT).
Historically, the PP has had a more solid core vote, and a higher turnout has tended to benefit the Socialists.
In 2004, voters turned out in high numbers - galvanised by the Madrid train bombings that killed 191 people three days earlier - to give Mr Zapatero a surprise victory over Mr Rajoy's conservative government.
This time, the faltering economy, rising inflation and unemployment, and immigration have all been high-profile campaign issues.
Credit crunch
After a decade of good growth, Spain's economy is stuttering. Inflation is at a 10-year high and unemployment is the highest this century.
The Spanish housing boom is dwindling, exacerbated by the global credit crunch.
Mr Rajoy's conservative opposition party focused on immigration, a bigger issue than in previous polls.
The Socialists, meanwhile, highlighted the liberal reforms of their time in office, including the introduction of a gender-equality law, fast-track divorces and same-sex marriage.
Spain's 35 million voters were electing 350 members of the Cortes, or lower house of parliament, and 208 members of the 264-member upper house, the Senate.
The remaining 56 Senate seats are decided by indirect election by assemblies in Spain's 17 autonomous regions.
Smaller parties, such as the United Left Party, and Catalan and Basque nationalist parties may hold the balance of power if the race is close.