MADRID — Political parties on Friday wrapped up campaigns for elections in Spain’s Basque and Galicia regions that offer a slim chance of ending the nine-month deadlock at national level and avoiding a third general election in a year.

Acting Prime Minister Mariano Rajoy’s conservative Popular Party has been running a caretaker government in Madrid following inconclusive national elections in December and in June. The party won the most seats in both but lacks the votes in Parliament to win a confidence vote to form a new government.

But now it hopes a strong showing in Galicia on Sunday and the possibility of a post-election deal with the ruling Basque Nationalist Party will strengthen its hand at national level.

Rajoy has the support of 170 lawmakers in the 350 seat parliament — 137 of them from his own party. But he is still six short of the majority needed to form a government. The Basque party commands five seats and their support would leave Rajoy needing just one more vote or an abstention.

Polls, however, indicate the nationalists will win the Basque election easily and will have no need to alter their stance against Rajoy.

Parliament has until Oct. 31 to produce a government or face a third general election.

Focus is also on the leading opposition Socialists who scored their worst ever results in the June national election, winning 85 seats.

Analyst Antonio Barroso, of the Teneo Intelligence political risk consulting group, said a bad showing in the regional ballots might lead to an internal revolt and force the Socialists to abstain and let Rajoy in.

Barring such a scenario, “it is unlikely that the elections will manage to change the status quo, which continues to point at new elections in December,” Barros said in a recent analysis note.

Spain has never had a coalition government and the country’s political elite are struggling with the idea of negotiating deals.