* PM Rajoy needs backing from opposition for bill
* Edging towards deal with some rivals, ups social spend
* Budget details expected around 1200 GMT
By Sarah White
MADRID, March 31 (Reuters) - Spain's minority government is expected to offer public sector pay rises and more social spending in its much-delayed draft budget for 2017 on Friday, steering further away from years of austerity as it tries to get the opposition to back the bill.
The budget is a major test of conservative Prime Minister Mariano Rajoy's chances of seeing out his four year mandate, after he was reinstated for a second term last October with the weakest grip on parliament in modern Spanish history.
The draft bill will be passed by Rajoy's cabinet eight months behind schedule - after two inconclusive elections left a power vacuum in Spain for over 10 months last year - and will then be subject to tweaks in parliament and a vote.
A brightening economic outlook over the past two months, which could lead Spanish growth to slow less than many initially expected this year, and improving public finances have helped give Rajoy leeway on the budget. His chances of passing it have increased after securing backing from the fourth biggest party and as he inches closer to a deal with some regional forces.
While the government's overall spending will not increase in 2017 and Rajoy had begun to step away from austerity measures in the run-up to a 2015 election, ministers have already signalled a further move away from those policies in recent days.
The government had flagged 4.2 billion euros of infrastructure spending in the Catalonia region for instance and a 1 percent pay rise for civil servants across the country.
It has agreed to lower value-added tax on theatre and concert entries, after Rajoy's tax hikes in the arts sector in 2012 proved deeply unpopular.
Budget Minister Cristobal Montoro said this week that, as part of the budget bill, the government would grant some 350,000 permanent contracts to temporary workers in the public sector, including 130,000 in health care.
Spain's public deficit fell within targets agreed with the European Union for the first time since the global financial crisis in 2016.
It needs to shrink to 3.1 percent of output in 2017 from 4.54 percent last year, but the government is relying on strong growth this year rather than the spending cuts that characterised Rajoy's first term to shrink it further.
Job creation and export growth was more robust than many economists had expected in January and February, and some believe output may now expand at a higher rate than the 2.5 percent official forecast.
Data is still mixed, however, and retail sales fell in January for the first time in almost two and half months as inflation spiked. They were flat in February, data on Friday showed.
Rajoy's chances of getting the budget through look a lot more promising than a few months ago.
Two opposition parties, the centre-left Socialists and anti-austerity Podemos ("We Can"), have already said they will vote against it.
But the government has clinched a deal with the fourth-largest force in parliament, centrists Ciudadanos ("Citizens"), to back the bill after agreeing to commit 4.1 billion euros ($4.38 billion) on social spending and promising not to raise taxes.
Rajoy is also wooing regional parties in the Canary Islands and Basque Country to get him across the line with the majority he needs.
His People's Party (PP) has 137 of parliament's 350 seats and 176 votes are required to pass the budget into law. ($1 = 0.9359 euros) (Additional reporting by Paul Day; Editing by Alison Williams)