After two sets of elections, the resignation of the leader of one of the main parties and the best part of a full year without a government, Mariano Rajoy is inching towards being named Spain's Prime Minister again.

And while he might have his likeness captured in the form of a Twitter emoji and his own hashtag for the day, things will likely get very difficult for him as he attempts to govern in a deeply divided parliament.

The debate surrounding the vote and inauguration took place across Wednesday and Thursday and, somewhat predictably in the wake of such a long period of stalemate and difficult negotiations, featured plenty of barbs and accusations being thrown across the floor.

The tense mood suggests that Rajoy's Partido Popular (PP) will face great difficulties in the task of governing in the coming weeks and months, as they depend on the Partido Socialista Obrero Español's (PSOE) abstention.

Rajoy was chastened by leader of Ciudadanos, Albert Rivera, and while they are supporting the PP, he warned that unless the objectives laid out in their agreement are met, "this won't last very long."

Pablo Iglesias, the leader of leftist party Podemos, also took his opportunity on Thursday to hit out at what he called the "triple alliance" of the PP, PSOE and Ciudadanos.

Image: Spain's Podemos Party leader Pablo Iglesias, centre, talks to lawmakers of his party at the end of a session at the Spanish parliament in July. Francisco Seco AP/Press Association Images

Claiming there were "more crooks in this chamber" than there were outside it, he added that the Spanish people have shown they are not afraid to vote for their brand of politics. Rather, he argued: "the only ones in Spain who are afraid are the elites and their parrots [...] We already govern in the main cities of this country. When we govern, we govern without fear, and we govern better."

Hitting back at Iglesias, Rajoy said: "You have a very high opinion of your own political power and of yourself, and that's not a bad thing. Because having that sense of optimism in life is something that helps you feel good, to feel at ease. But, you should also proceed with caution because reality tends to be ruthless. That's something that none of us present today should forget.

"Let's talk about democracy, and about why am I here, today, presenting myself for this inauguration ceremony, and you [Mr. Iglesias], for example, are not. Why am I here, and you're not? Because that's the way it is. Let's see if I can explain it.

"It's because the Spanish people have backed, by a majority, the Partido Popular. And that is very important. That's why I said that we were going to talk about democracy."

The back and forth did not go unnoticed in the chamber by the other deputies either, as Lucia Mendez of Spanish publication El Mundo noted many of them watched the insults volleyed back and forth like a tennis rally.

Somewhat sidelined during this conversation were the PSOE, the socialist party who went through their own upheaval throughout the late summer. Leader Pedro Sanchez resigned at the start of this month as a result of losing a vote of the PSOE's assembly, having refused to budge negotiations with Rajoy over forming a new government.

Speaking on Thursday morning, PSOE spokesman Antonio Hernando endeavoured to make clear that his party's abstention was just that, and was not a gesture of support.

"Mr Rajoy, we don't like you as prime minister, but we do like this country and the democracy that we have," said Hernando. "Today, Spain needs us, and peoples’ problems cannot remain blocked because of the selfishness of any one party. There are more than enough reasons not to trust you, but there is no reason to keep up the deadlock."

Image: Spain's acting conservative Prime Minister and Popular Party leader Mariano Rajoy, right, is greeted by his party members after speaking at the investiture debate on Wednesday. Daniel Ochoa de Olza AP/Press Association Images

Given how much attention was given to Podemos and Iglesias in Rajoy's speeches, it may be that the PP have decided that the party's growing support means they are the real ideological challengers to their government, making the PSOE's predicament even more precarious.

A round of votes will take place on Thursday at 7pm, but Rajoy is aware that he will not be returned to power just yet. Instead it looks as though he will be voted in as leader on Saturday by a simple majority.

If today's proceedings are anything to go by, however, being able to remove the word "acting" from his title is unlikely to make life any easier for Prime Minister Rajoy in the coming weeks and months.