Spaniards angry with 21% unemployment and seemingly endless corruption cases are voting in an historic national election - and the country's traditional two-party political system may be broken up by strong showings for two new upstart parties.

Spaniards angry with 21% unemployment and seemingly endless corruption cases are voting in an historic national election - and the country's traditional two-party political system may be broken up by strong showings for two new upstart parties.

Spain has been dominated for more than three decades by the ruling Popular Party and the main opposition Socialists, which have alternated running the government.

But many voters casting ballots on Sunday are expected to support the business-friendly Ciudadanos party or the far-left Podemos party.

Polls predict the right-of-centre Popular Party will get the most votes but not enough to retain its parliamentary majority.

Prime minister Mariano Rajoy has said he would seek an alliance with politicians outside his Popular Party to prevent a leftist coalition from taking power.

Spain's 36.5 million registered voters are electing representatives to the 350-seat lower house of parliament and to the senate, which has less legislative power.

Spain could end up with a host of coalition government possibilities. The most likely ally for the Popular Party is Cuidadanos, while the Socialists would probably team up with Podemos. There is also the possibility of a three-way alliance between the Socialists, Ciudadanos and Podemos.

Days or weeks of negotiations may be needed to determine the outcome - which will be unprecedented because the Socialists and the Popular Party have previously only needed support from tiny Spanish parties to get a majority in parliament when they did not win one from voters.

The nation's devastating economic crisis, non-stop corruption scandals and a separatist drive in the north-eastern region of Catalonia have dominated Spanish politics over the past four years.

Mr Rajoy has boasted about his handling of the economy, done his best to skirt the corruption minefield and has vowed to halt the independence push.

His administration's biggest success has been in pulling Spain back from an economic abyss in 2012 and returning the economy to steady growth, but the jobless rate still stands at 21%. This has fuelled claims by Ciudadanos and Podemos that the Socialists plunged Spain into an economic crisis and the Popular Party has failed to fix the problem.

Mr Rajoy's party also adopted unpopular austerity measures and labour and financial reforms that are credited with creating jobs but damaging the country's social welfare system. Although Spain's economy is now one of the fastest-growing in the 28-nation European Union, its unemployment rate is the second-highest in the EU after Greece.

His administration has been hurt by his U-turn on a promise not to raise taxes and by cuts to national healthcare and public education. Many Spaniards are also angry about what they perceive as the impunity of politicians and business leaders amid incessant corruption cases.

The question of independence for economically and politically powerful Catalonia has divided that region and soured political ties with the rest of Spain. Mr Rajoy vows to quash what is seen as the biggest threat to Spanish unity in recent decades. Other parties favour negotiations to devolve more power to Catalonia.

Mr Rajoy, 60, champions conservative social policies, siding with the Roman Catholic Church against abortion.

Pedro Sanchez, a 43-year-old former university economics professor, was unknown to most Spaniards until he was elected leader last year of the Socialists.

Ciudadanos has the eloquent, media-savvy Albert Rivera as its leader. Rivera, at 36 the youngest candidate, was a national debating champion. His moderate, business-friendly policies plus a pledge to crack down on corruption have attracted voters.

Political science professor Pablo Iglesias and his radical left Podemos party want to break the mould of Spanish politics. The ponytailed 37-year-old is an ally of Greece's leftist prime minister Alexis Tsipras. The Podemos party itself was born from massive Madrid street protests in 2011 that drew mainly young Spaniards weary of corruption.

The country's drab two-week campaign got a jolt on Wednesday when a 17-year-old student punched the prime minister in the face during a campaign appearance in Mr Rajoy's home town. The boy's lawyer said the attack was not politically motivated, but did not give a reason for it.

Mr Rajoy also raised questions about his future as the Popular Party leader by including his deputy, 44-year-old Soraya Saenz de Santamaria, on campaign posters that would traditionally be reserved for him.