Spanish prime minister Mariano Rajoy has strongly denied wrongdoing in a growing corruption scandal that threatens to erode his credibility just as he is making headway against a deep economic crisis.

The ruling People's Party (PP) has been buffeted all week by media reports alleging that its former treasurers operated a slush fund.

Donations were claimed to come from construction industry executives that were then doled out to Mr Rajoy and other party leaders.

Mr Rajoy, who has a reputation for being boring but clean, welcomed an investigation into the affair and said his party would be fully transparent and that he would publish on the internet all of his tax declarations to clear up the scandal.

Last week El País newspaper published extracts from what it said were secret ledgers maintained by party treasurers over 20 years.

Dozens of police in riot gear guarded PP headquarters in central Madrid today. 

A small gathering of demonstrators shouted "resign" outside the building after several hundred people protested there on Thursday and Friday nights.

The scandal has hit Rajoy, 57, just as he had appeared to make some headway in the country's financial crisis.

Last year doubts over Spain's solvency forced state borrowing costs dangerously high and Mr Rajoy looked to be on the brink of seeking an international bailout as Greece, Portugal and Ireland have.

But market attacks have abated since the European Central Bank pledged it would back Spain.

Mr Rajoy has asked Spaniards for sacrifices and slashed spending.

His popularity has plummeted during his 13 months in office as his austerity measures aggravate a deep recession and 26% unemployment.

The small opposition United Left party has urged him to resign and call early elections over the scandal.

But the PP has an absolute majority in parliament and so far has shown no signs of a split that would allow opponents to carry a vote of no confidence.

The main opposition Socialists have demanded explanations from Rajoy without calling for his resignation. Polls show they would not win an election if it was held now.