With 99.95 per cent of votes counted, Zapatero's Socialist party was predicted to secure 169 seats, short of the 176 need for an overall majority in the 350-member assembly, against 153 for the conservative opposition Popular Party.
In the last legislature, the Socialists had 164 seats and the PP had 148.
'Firm but open hand'
"We can say with clarity the Socialist party has won the elections," Jose Blanco, the party's secretary-general, said.
Zapatero told euphoric supporters outside the party's headquarters in Madrid that "the Spanish people have spoken clearly and decided to start a new era".
|"I will govern with a firm but open hand" |
Jose Luis Zapatero, Spain's prime minister
"I will govern with a firm but open hand," he said.
The prime minister's victory was seen as finally giving him a legitimacy that critics say he has lacked.
Many conservatives had considered Zapatero's 2004 victory a fluke, and had seen Sunday's vote as their chance to correct it.
The opposition conservatives conceded defeat, but took solace from the fact their party also picked up seats, with both parties gaining at the expense of smaller leftist and regional groups.
Mariano Rajoy, the conservative leader, told supporters in Madrid that he had "called the candidate of the Socialist party and wished him luck for the good of Spain".
The government said turnout on Sunday was high, but less than in 2004.
Spain's youth vote helped boost participation to 76 per cent four years ago in outrage at what they saw as the then governing Popular party's efforts to cover up who was responsible for election-eve bombings that left 191 people dead.
Zapatero, the then opposition leader, came from behind to win power on a wave of voter anger at the PP, which tried to blame the Eta Basque separatists for the bombings by Muslim radicals.
Zapatero had also promised to withdraw Spanish troops from Iraq and honoured that pledge soon after taking office.
He also launched a drive to cede more power to Spain's semiautonomous regions.
In his next term, his main task will be to boost the once booming but now slowing economy, shaken by the sub-prime mortgage crisis in the US and a cooling construction sector.
|Mariano Rajoy, right, conceded defeat |
and wished Zapatero luck [AFP]
One of Europe's great success stories with more than a decade of robust growth is now cooling amid rising unemployment and high inflation.
Observers say that an end to a boom in the construction sector, the strongest engine of growth, is to blame.
Economists said growth could fall as low as 2 per cent this year - a rate not seen since the early 1990s - from more than 4 per cent a year ago as a global credit squeeze chokes Spain's already-cooling property sector.
The sector accounts for almost a fifth of Spain's GDP and jobs. Unemployment, which hit a 29-year low last year, is up by almost 300,000 since June to 2.3 million.
Highly indebted Spaniards, already struggling to meet higher mortgage repayments, are suffering from rising food and fuel prices that pushed inflation to a record 4.4 per cent in February.
Many are also unsettled by an unprecedented influx of more than three million registered immigrants in the past eight years - most of them from Morocco, Eastern Europe and Latin America.
Both main parties clashed over immigration, with the conservatives saying Zapatero, 47, had made Spain a magnet for destitute foreigners in search of a better life, draining resources for schools and healthcare.
Rajoy had vowed to make immigrants sign a contract obliging them to respect Spanish customs and learn the language.
Zapatero's party called this position xenophobic.
In two heated election debates, Rajoy repeatedly accused Zapatero of lying about his dealings with Eta during and after failed peace talks in 2006.
The candidates also clashed on Zapatero's willingness to grant more self-rule to Spain's semi-autonomous regions.
The prime minister also faces the challenge of the resurgence of Eta, which ended a ceasefire in December 2006 and allegedly made a dramatic show of force with the killing of Isaias Carrasco, a member of the prime minister's party and former municipal legislator.