The final public opinion poll, which came out on Monday, gave Zapatero's Socialists a four-point lead over the opposition Popular Party, headed by Mariano Rajoy.
That would leave the Socialists as the largest party, but without an overall majority, as occurred four years ago when Zapatero scored a surprise win over Rajoy.
Jose Luis Rodriguez Zapatero
- Elected prime minister in 2004, he quickly withdrew Spanish troops from Iraq.
- Angered Roman Catholic church by legalising same-sex marriages and making it easier for Spaniards to divorce.
- Enacted an amnesty for illegal immigrants, granting work and residency papers to 700,000 of them.
- Is seen as having failed in a bid to negotiate peace with Basque separatist movement Eta.
- Leads opposition Popular Party and is making his second attempt to win election as prime minister, after losing
- Has pledged strict law-and-order measures to control immigration, and promises education reforms.
- Says will not negotiate with Eta, if elected
His party has since governed as part of an alliance with the Republican Left of Catalonia separatist party, and the United Left, a coalition of Greens and communists.
Zapatero refused to rule out another alliance with a small party, but has yet to reveal his intentions, hoping that the election outcome will give him room to manoeuvre.
On Thursday, the Basque Nationalist Party offered Zapatero a "pact that sets the basis for a solution to the Basque political conflict".
The moderate nationalist Catalan Convergence and Unity Party has also announced it is ready to join a Socialist government, but has conditioned its support on "the full imposition" of a controversial law that grants greater autonomy on the northeastern region of Catalonia.
In a rally before more than 30,000 people in the Catalan capital of Barcelona on Thursday night, Zapatero vowed to represent "all flags, all ideas, all languages".
He was accompanied by Felipe Gonzalez, a former Socialist prime minister, who urged supporters not to waste their votes on smaller parties.
"What I don't want to see are wasted votes that will result in a win by those who should not win," he said.
Opposition leader Rajoy also sought to lure undecided voters.
In a rally in the Spain's third city of Valencia, he told supporters: "We don't want any more divisions, tensions, policies that destroy harmony between Spaniards."
He was referring to Zapatero's policies of granting more autonomy to Catalonia and failed peace talks with the armed Basques separatist group Eta, as well as the government's liberal social reforms such as laws on same-sex marriages and fast-track divorce.
Rajoy has also vowed to take a hard line on immigration and accused Zapatero of mismanaging the economy, which has begun to slow following a construction-led boom.
Zapatero scored a surprise win over Rajoy in the last election held on March 14, 2004, just three days after the Madrid train bombings which killed 191 people.
Voters were infuriated over the Popular Party's insistence that ETA was to blame for the attacks even though evidence pointed to Islamic groups angered by the government's commitment to involvement in the US-led invasion of Iraq.