His detractors have called the results of the December 21 election, which saw separatist parties hold on to their majority in the Catalan parliament, a “fiasco” and a “rout” for Rajoy, in power since 2011.
Pro-independence parties failed to win a majority of ballots cast but neither did parties in favour of Spanish unity do as well as was hoped for by the majority of Spain's political class.
Rajoy's conservative Popular Party (PP) saw its marginal representation in the 135-seat Catalan parliament reduced even further, to just four seats, from 11 previously.
Its main rival, the relative newcomer Ciudadanos, won the most seats with 36, mainly by luring away traditional PP supporters.
At first glance Rajoy appeared to have lost his bet by calling the snap polls after he invoked constitution article 155, allowing him to suspend Catalonia's autonomy and impose direct rule in response to the separatists' independence drive.
But political consultant Ignacio Varela said, “article 155 played its role which was not to win the elections or improve the PP's results, or make separatism disappear, but rather to stifle a rebellion against the constitution.”
Catalonia's three separatist parties had approved laws in September to “disconnect” the region from Spain, organised a banned independence referendum on October 1 and then proclaimed independence on October 27.
After Rajoy intervened, experts said the separatists recognised that they had underestimated the capacity of the Spanish state to react.
They have said they no longer plan to push for independence unilaterally and favour a negotiated settlement instead.
“Enacting article 155 broke a taboo, without sparking a rebellion,” said Pablo Simon, a politics professor at Madrid's Carlos III University.
Rajoy has warned repeatedly that he will not hesitate to invoke article 155 powers again if separatists once again break the law.
Pro-independence parties are now divided over what strategy to follow and may have a hard time capitalising on their success.
This is especially true because the candidate whose list won the most seats, deposed Catalan president Carles Puigdemont, fled to Belgium to avoid arrest “and his return is not expected”, Oriol Bartomeus, a political scientist at the Autonomous University of Barcelona.
The result of the elections will have a cost for Rajoy as “PP voters will be strongly tempted to switch their votes to Ciudadanos”, further weakening his minority government, said Varela.
The PP is likely to struggle to win the support of the Basque National Party (PNV), whose five votes in the national parliament are needed to adopt the 2018 budget, as long as Catalan separatist leaders are being pursued by the courts, he added.
But Anton Losada, a professor of politics at the University of Santiago de Compostela who has written a book about Rajoy, said he believes PNV leader Inigo Ukullo, who needs the support of regional PP lawmakers to keep his post as head of the Basque regional government, will not tie his fate to the Catalan separatists.
And both Bartomeus and Losada downplayed the threat Ciudadanos represents to the PP.
“The logic of strategic voting, that led Catalan voters to Ciudadanos because it was the formation that could win, will play in the PP's favour in national elections,” said Bartomeus.
2018 will be difficult for Rajoy “but what year hasn't been difficult for him?” Losada asked.
“I think he will complete his term, approve budgets and if he wants he will run again in the elections” slated for 2020, he added.