The election pits those hungry for change in a country with high unemployment against those who fear it would torpedo Spain's slow economic recovery.
Britain's shock vote to leave the European Union has further exacerbated this division.
The outgoing conservative Popular Party (PP) is insisting on the need for "stability" in the face of "populism" - a thinly-veiled dig at the Unidos Podemos coalition.
Voters have the choice between four major political groupings after the emergence of Podemos and centre-right upstart Ciudadanos last year uprooted the country's two-party dominance.
More From This Section
Opinion polls - conducted pre-Brexit - suggested the results Sunday would also be fractured, with the PP coming first without a majority, tailed by Unidos Podemos, which could replace the 137-year-old Socialist party as Spain's main left-wing force.
If so, political leaders will have to go back to the negotiating table, under more pressure this time to form a coalition.
Throughout the campaign - and again on Friday after Brexit - the PP has hammered away at the need for stability in reference to the rise of Unidos Podemos, which like Greece's ruling Syriza party rejects EU-backed austerity and pledges to fight for the least well-off.
Unidos Podemos - the "o" of Unidos shaped as a heart - has run an emotional campaign.
Iglesias said Spain needed a coalition government of Podemos and the Socialists as he cast his ballot at a high school in Vallecas, the working class neighbourhood in southern Madrid.
He said Podemos would "sooner or later govern in Spain", adding that he hoped it would be now "because the country can't wait".
Rajoy has argued that since the PP came to power in 2011, it has brought Spain back to growth and overseen a drop in unemployment - though at 21 per cent it is still the second highest rate in the European Union after Greece.
In the latest case, Interior Minister Jorge Fernandez Diaz was caught on tape talking to an anti-fraud official, apparently discussing how to incriminate his political rivals - an incident Rajoy shrugged off as a "farce".