* Acting PM Rajoy says ready to face confidence vote
* First vote likely to fall on Aug. 31
* Rajoy says agrees on reform pact to win Ciudadanos support
* But obstacles linger, with Socialists opposed (Updates with date of investiture vote, quotes)
By Angus Berwick and Sarah White
MADRID, Aug 18 (Reuters) - Spain's acting prime minister Mariano Rajoy, bidding to end an eight-month political stalemate, said on Thursday he was ready to face a confidence vote on forming a new government after agreeing terms for a pact with centrist rivals.
Spain has been without a working government since December, when national elections ended inconclusively. After the four main parties failed to agree terms on forming a coalition, a second ballot was held in June with a similar result.
Rajoy, whose centre-right People's Party (PP) came first in both ballots, told a news conference he had agreed to a reform package demanded by the smaller centrist Ciudadanos ("Citizens") party to win their support in the confidence vote.
"We have taken a decisive step towards forming a government so that there will not be another election," Rajoy told journalists after meeting Ciudadanos leader Albert Rivera.
However, even the PP and Ciudadanos together would still be short of the majority Rajoy needs to be invested for a second term as prime minister.
Support or at least an abstention from the Socialists, who finished second in both ballots, would give him that majority - but they reiterated on Thursday that they would oppose Rajoy.
"As is well-known, the Socialists' vote will be a negative one in the investiture session," the party said in a statement.
Ciudadanos came fourth in the Dec. 20 and June 26 elections. It had set out a six-point pact of anti-corruption and political reform measures as a condition of its support.
The party, which has until now said it would only abstain in parliament during a PP administration, said it would start further negotiations with Rajoy on Friday.
'DOWN TO THE WIRE'
The vote is likely to take place on Aug. 31, according to a parliamentary schedule provided by the house speaker.
If a first vote fails, under Spanish law, a second can be called 48 hours later, in which the candidate for prime minister needs only a simple majority.
An abstention from the Socialists at that point would enable a PP-led minority government, even if it would likely be unstable.
Rajoy urged the Socialists on Thursday to enable a PP-led government, but it is still unclear what it will take for the Socialists to cede ground.
A looming deadline to pass a budget for 2017 and present it to Brussels by mid-October, at a time when Spain is trying to keep its resilient economic recovery on track, will add to pressure on the centre-left party to shift its position.
"The big issue is the Socialist party - it might well be that we have to go through a failed investiture to later get a government," said Antonio Barroso, a political analyst at Teneo Intelligence. "This is going to go down to the wire."
Should Rajoy fail to win the second confidence vote - likely to fall on Sept. 2 - it would trigger a two-month window to form a government, at the end of which another election could have to be called.
That new ballot would be the third in little more than a year. It would likely fall on Christmas Day, Spanish media reported. (Additional reporting by Blanca Rodriguez; editing by John Stonestreet)
Our Standards: The Thomson Reuters Trust Principles.