Access to market funding got tougher for Spanish banks in July, Bank of Spain data showed, though conditions were said to have improved after health checks on the country's lenders were published on July 23.

The country's banks borrowed 140 billion euros ($180 billion) from the European Central Bank in July, up from 136 billion in June, the data published on Friday showed.

Taking off the amount banks then redeposited at the ECB, the total borrowed was 130 billion, up from 126 billion euros, just under a third of the overall amount lent by the ECB.

Spanish banks had tapped the facility for 90 billion euros in April before interbank markets gummed up on fears other euro zone periphery countries could face debt crises along the lines of Greece.

A source said ECB borrowing by Spanish banks eased in the last week of July, after the results of stress tests on European banks were published. Spain's lenders came through better than feared even though five of the country's smaller banks failed.

August data would likely show less reliance on the ECB, the source said.

But Carlos Peixoto, bank analyst at BPI, said that data were unlikely to turn around in August given money market conditions had worsened in recent days.

It's already discounted that in August, banks will still be accessing ECB funding, he said.

Everyone is now looking toward September and October to see if the markets open to the smaller Spanish banks and there is investor appetite for their debt.

Smaller banks in Spain lost access to interbank markets in late May heading into June over concerns that Spain's debt problems could come to rival those of Greece, where banks are heavily dependent on ECB financing.

Reports at the beginning of August suggested they were still struggling, even if larger banks had even returned to debt markets as financing costs had eased.

Euro zone banks borrowed a total of 448 billion euros in July, down from 496 billion in June.

Borrowing jumped in June partly because of funding difficulties, but also as banks built up funds as a precautionary measure before the expiry of 442 billion euros at the start of July.

(Additional reporting by Judy MacInnes; Editing by John Stonestreet)