Spain has been stymied by political uncertainty for more than a year. But now the country is on track to finally have a government.

Spanish caretaker prime minister and leader of the Socialist Party (PSOE), Pedro Sánchez, is expected to win the second vote on his investiture on Tuesday (7 January), after he failed to get an absolute majority in the first-round on Sunday in an extremely tight result.

Student or retired? Then this plan is for you.

However, this time the socialist candidate simply needs to get more 'yes' than 'no' votes to secure his new government.

Sánchez in November won the highest number of seats in the congress, in what was the fourth Spanish election in just four years.

But, as at the previous bid in April, the Socialists fell short of an absolute majority (176 MPs in the 350-seat parliament).

First coalition government

Sánchez and the leader of the leftist Unidas Podemos (United, We Can) party, Pablo Iglesias, quickly reached an agreement to form a coalition government - although the combined pair do not have a majority.

They have committed to implement reformist policies, which include tax rises for higher earners, an increase in the minimum wage and labour reforms.

However, smaller and regional parties hold the key to the success of what is to be the first coalition government since Spaini's transition to democracy in the late 1970s.

The abstention of the pro-independence Esquerra Republicana de Catalunya (ERC), whose leader Oriol Junqueras was sentenced to 13 years in prison over his role in the 2017 failed bid for independence, is essential to confirm the Socialist leader as prime minister on Tuesday - thanks to the ERC's 13 deputies.

Negotiations between PSOE and ERC had been long and difficult. But, Sánchez finally secured the support of Catalonia's largest separatist party thanks to a highly-criticised deal that paves the way for a "bilateral" forum between the central and regional governments over the future of Catalonia.

According to the text, if any deals are reached, they will be subject to a vote by citizens of Catalonia.

But any possible deal will have to comply with "the framework of the legal-political system".

Political price?

The leader of the opposition Partido Popular (PP) party, Pablo Casado, has accused Sánchez of being a "walking lie" and "the leader of those who want to finish with constitutional Spain".

"You have lost the dignity of leading a party that supports the constitution and you also have lost your decency," he said to Sánchez.

Additionally, Casado has also threatened Sánchez with legal action if he does not back the disqualification from office of president of Catalonia Quim Torra - who was found guilty of disobedience.

According to Sánchez, "Spain is not going to break up and the constitution will not be violated".

"What is going to be broken is the blocking of the progressive government that was voted for democratically by Spaniards," he told deputies at the weekend.

Sánchez has the support of smaller regional parties such as the Basque Nationalist Party (PNV), Cantabria's PRC, the Valencia-based Compromís and Canary Islands party Nueva Canarias.

But Popular Party (PP), far-right Vox and Ciudadanos (Citizens) have all consistently refused to endorse the coalition government supported by the Catalan separatist party.

In Sunday's vote (5 January), Sanchez narrowly 'won' - 166 votes to 165 against, with 18 abstentions - but not an absolute majority. On Tuesday he merely needs more 'yes' than 'no' votes.

But, if just two deputies fail to vote the way that is expected on Tuesday, Spain could be facing its third general election in a year - which would be the fifth in five years.