BEIJING, Aug 30 (Reuters) - Four of China’s top five state-owned banks, including Industrial and Commercial Bank of China Ltd (ICBC) and Bank of China Ltd (BoC) , posted a better-than-expected rise in quarterly profits as margins and bad loan levels stabilised.

Net interest margins (NIM) - the difference between interest paid and earned by banks - have fallen sharply for Chinese banks following six benchmark interest rate cuts in 2014-15. But signs of recovery are evident from the half-yearly results of ICBC and BoC, both of which saw the gauge of profitability widen.

ICBC’s net interest margin increased to 2.16 percent by end-June, from 2.12 percent at end-March, while BoC’s rose to 1.84 from 1.80 percent over the period.

ICBC, China’s top bank by assets, posted a net profit of 77.2 billion yuan in the second quarter, up 2.3 percent from a year ago, Reuters calculations based on the lender’s 6-month results show. Analysts had on average forecast a 1.7 percent rise.

Among China’s other state banks, the Agricultural Bank of China Ltd and Bank of Communications Co Ltd , the country’s No.5 lender, also turned in consensus-beating quarterly profit numbers.

All four lenders reported lower or steadying non-performing loan (NPL) ratios at the end of June.

“The demand for loans is stronger than past years. Meanwhile local governments are also increasing investment and Chinese companies are going overseas, so BoC’s loan in the first half grew relatively fast,” BoC Vice President Gao Yingxin said.

But there are concerns lenders may face headwinds later this year from higher funding costs and slower loan growth amid a shadow banking crackdown.

Analysts estimate some banks have used 80 percent of their yearly credit quota over January-June, versus the usual 60 percent, amid the regulatory push to bring shadow financing activities to the main loan book, meaning lenders will have less money with which to make profits in the second half.

BoCom has said it plans to shore up margins by reducing cost of liabilities and operations in the second half, while BoC said it expects asset quality to remain stable for the full year.

However, BoC said there was still pressure to resolve non-performing loans. Its NPL ratio fell to 1.38 percent at end-June, from 1.45 percent at end-March.