By Amanda Calvo and Inmaculada Sanz
MADRID (Reuters) - Parliament will begin debating on Wednesday whether to back acting Prime Minister Mariano Rajoy's bid for a second term, raising the prospect that Spain could have a new government by the weekend after a 10-month deadlock.
Rajoy said he had accepted a mandate from King Felipe to try again to win parliamentary support to form a government after his conservative People's Party (PP) won two elections in December and June but failed to secure a majority.
The Socialists, who had previously voted against a Rajoy-led government, switched position last Sunday by announcing they would abstain in the next confidence vote on Rajoy, paving the way for him to stay in power.
"Spain needs a government as soon as possible and I am obliged to make that happen," Rajoy told reporters after meeting the King.
Speaker Ana Pastor said parliament would begin a confidence debate on Rajoy on Wednesday evening. A parliamentary vote of confidence is expected on Thursday, when Rajoy will need a green light from a majority of deputies to stay in power.
If he fails to achieve a majority, a second vote would be called 48 hours later in which parties can abstain, opening the door for the Socialists to enable a Rajoy-led minority government. That is likely at the weekend.
If parliament fails to elect a new prime minister by Oct. 31, it would face dissolution. That would automatically send Spaniards back to the polls on Christmas Day, though analysts now consider it unlikely.
But a new administration could still face deadlock as Spain turns its attention to its 2017 EU budget deficit target, which requires it to generate at least 5 billion euros (5.43 billion) through cuts or revenues.
The Socialists' interim head, Javier Fernandez, said on Tuesday the party would not approve any budgets proposed by an incoming center-right government.
"In no event do we plan on giving stability to Rajoy's government or approving its budgets," said Fernandez, who took over after his predecessor Pedro Sanchez quit earlier this month due to a party revolt over his leadership.
Rajoy said on Tuesday he was aware of the difficulties a minority government would face and conceded that a stable government would require dialogue and deals with other parties.
"I guarantee to you that if I am invested in the vote I will work from the first day so that this government is capable, stable and long-lasting."
(Writing by Adrian Croft; Editing by Angus Berwick/Mark Heinrich)