China's economy grew faster than expected in the second quarter, easing fears of a hard landing and strengthening Beijing's resolve to fight persistently high inflation.

China's statistics office said on Wednesday that stabilizing prices remained the top priority, even though a complex and volatile global economy posed a threat to growth, complicating the policy choices.

Second-quarter gross domestic product rose 9.5 percent from a year earlier, exceeding economists' forecasts for 9.4 percent growth, helped by solid domestic consumption and investment.

But that was still the slowest pace since the third quarter of 2009, when the world economy was pulling out of its worst recession in 80 years.

Some cooling was expected -- and even welcome -- because China has raised interest rates and clamped down on bank lending to try to ease inflation, which hit a three-year high in June. The stronger-than-expected GDP figures suggest Beijing may have more room to tighten without choking off growth.

These are very good numbers, said Liu Li-Gang, an economist with ANZ in Hong Kong.

This is perhaps the reason the (central bank) raised interest rates last week. They are showing they are not afraid of a significant slowdown in the economy.

For investors worried that Beijing's tightening campaign might exact too heavy a toll on the fastest-growing major economy in the world, the figures offered some reassurance. Industrial output in June was also stronger than expected, growing at its fastest pace in over a year.

Asian stocks, metals and the Australian dollar all rose.

China's GDP in April to June rose 2.2 percent from the first quarter on a seasonally adjusted basis, a slight pick-up in pace from 2.1 percent in the first quarter.

Chinese officials have struck a hawkish note in recent days, mindful of the risk that overheating inflation could stoke civil unrest.

Although many economists think overall inflation pressures will ease during the second half of the year, prices have soared for popular staples such as pork and it will take time for them to recede.

A small majority of analysts expect the central bank to raise interest rates again this year and most forecast further increases in bank reserve ratios, a Reuters poll last week showed.

Sheng Laiyun, a spokesperson for China's statistics bureau, said stabilizing inflation was the primary goal, and policies would be targeted, flexible and effective, echoing recent remarks by Premier Wen Jiabao.

It's not easy and China has done a great job to maintain fast economic growth when the global situation is complex and volatile, Sheng said.

Europe's sovereign debt troubles and a slowdown in the U.S. economy means two of China's best export customers are struggling. New export orders slipped in June, a manufacturing survey showed earlier in July, which raised questions about China's growth prospects.

But Wednesday's figures suggested domestic demand remains robust. Final consumption contributed 4.6 percentage points to first-half growth, while exports subtracted slightly, China's statistics bureau said.

Analysts say China's economy is on course for growth well above 9 percent this year, a rate that would be the equivalent of adding Switzerland's GDP to the $6 trillion economy.

Still, demand weakness in China's Western export markets may cause economic growth to slacken in the third quarter from the second, they say.

REBALANCING

Industrial output rose 15.1 percent in June from a year earlier, the strongest growth since May 2010. It also marked a sharp quickening from May's 13.3 percent and beat market expectations of 13.1 percent.

The growth figures underlined the resilience of the world's second-largest economy, thanks to the country's rapid urbanization, and could soothe investor concerns about an abrupt slowdown that would dent demand for global commodities.

The data should also help to dispel the wilder fears of an economic collapse in China, said George Worthington, an economist with IFR, a Thomson Reuters unit.

Fixed-asset investment grew 25.6 percent in the first six months from a year earlier, while retail sales expanded 16.8 percent, showing that domestic demand still held up relatively well despite policy tightening.

The economic growth data are quite upbeat and industrial production is noticeably stronger than expected, said Xu Biao, an economist with China Merchants Bank in Shenzhen. It's quite beyond expectations as Chinese imports and (purchasing manager's survey) in June were quite weak.

Stronger demand at home not only helps insulate China from the global turmoil, it provides a bit of a buffer for the rest of the world and evidence that Beijing is making good on pledges to move away from export-driven growth. But it can also increase price pressures.

Fighting inflation remains Beijing's top priority but any policy steps should avoid causing big swings in economic growth, Premier Wen said in comments published on Tuesday.

He signaled in June that the country would struggle to meet its 4 percent average inflation target in 2011. Monthly consumer price figures show inflation averaged 5.4 percent in the first half of the year.

An academic adviser to the People's Bank of China was quoted by state television on Wednesday as saying the inflation rate may have peaked in June, when it hit 6.4 percent.

Li Daokui, a member of the central bank's monetary policy committee, said the full-year inflation rate could be around 4.8 percent.

Last Wednesday, China raised rates by 25 basis points -- the third such increase this year -- which took the one-year bank deposit rate to 3.5 percent.

The central bank has raised benchmark interest rates five times since October and lifted banks' reserve requirement ratio -- its preferred policy tool so far -- nine times.

(Additional reporting by Langi Chiang, Gui Qing Koh and Zhou Xin: Writing by Emily Kaiser: Editing by Neil Fullick)