(Reuters) - China’s industrial engine cranked up again in May, reassuring investors worried about slowing growth in the world’s second-biggest economy as it grappled with debt risks and tried to shake off a stinging ratings downgrade from Moody’s Investors Service.

FILE PHOTO - Workers direct a crane lifting newly made steel bars at a factory in Dalian, Liaoning province, China, October 13, 2015. REUTERS/China Daily/File Photo

Moody’s sees an improving global outlook even as it warned of a slowdown in China later in the year as liquidity-tightening measures take effect.

The ratings agency said the biggest risks to global growth, including protectionism and European Union exits, seemed to have subsided, although an opinion poll in Britain pointed to the danger of a hung parliament in elections next week.

Moody’s expects 2017 growth for China at 6.6 percent, in line with the official target of at least 6.5 percent.

China’s official Purchasing Managers’ Index (PMI) eased worries about a sudden slowdown after a run of weak readings of April data. The PMI was at 51.2 in May, steady from April’s 51.2 and up versus forecasts of 51.0 in a Reuters poll.

“The latest official PMI readings add to broader evidence that downward pressure on growth has eased lately,” said Julian Evans-Pritchard, China Economist at Capital Economics.

“Looking ahead, however, we suspect that the current stability... will prove temporary. With the regulatory crackdown on financial risks still weighing on credit growth, it will be difficult to avoid a further slowdown in the coming months.”

Private surveys on factory activity for most Asian economies will be released on Thursday.

Chinese stocks .SSEC, .SZSC edged higher and the onshore yuan CNY=CFXS hit a four-month high against the dollar.

Activity in China’s steel industry grew at the fastest pace in a year in May, supported by an increase in new orders. The steel sector PMI rose to 54.8 from 49.1 in April, climbing above the 50-point mark that separates growth from contraction.

Trade headwinds remain a risk, with U.S. President Donald Trump’s administration keen to tackle what it regards as China’s “unfair and illegal” sales of underpriced steel.

The steel sector helped drive China’s strong first-quarter growth, but the reliance on the investment-led model has raised questions about whether it will be sustainable given official pledges to cut debt levels of nearly 300 percent of GDP.

In cutting China’s sovereign rating for the first time in nearly 30 years last week, Moody’s cited the contradiction between using stimulus to meet growth targets and trying to reduce debt in the economy.

The big question for investors is how far Chinese authorities will go in their attempts to curb bubble risks.

Most analysts argue that Beijing will tread carefully for fear of knocking the economy hard, though investors worry that a significant credit contraction in China will reverberate through financial markets and the global economy.

IMPROVED OUTLOOK

Moody’s said it expected G20 economies, which account for 78 percent of the global economy, to collectively grow at an annual rate of 3.1 percent this year and next, from 2.6 percent in 2016.

In a positive sign, factory output in Japan, the world’s third-biggest economy, grew at the fastest pace in almost six years, taking production to its highest level since 2008.

South Korea’s industrial output declined unexpectedly, however, adding an element of uncertainty for the central bank, which plans to upgrade its 2017 growth outlook from the current 2.6 percent.

One factor Moody’s said had improved the outlook was the election of Emmanuel Macron as French President, which reduced the risk of a European Union exit by a major country.

In Britain, which is negotiating its exit from the bloc, a new constituency-by-constituency modelling by YouGov showed the Conservative Party might lose 20 of the 330 seats it holds while the opposition Labour Party could gain nearly 30 seats.

The news came after a string of opinion polls showed a narrowing lead for Theresa May’s Conservatives, shaking investors’ confidence that May would easily win a majority in next week’s national election.

Moody’s singled out Britain as one of the advanced economies that shows signs of slowing, as Brexit-related uncertainty weighs on consumer spending and investment.

On Monday, European Central Bank President Mario Draghi said euro zone growth may be improving but inflation remains subdued, arguing that the extraordinary monetary policy support was still needed to raise inflation back to the bank’s 2 percent target.

(Corrects April PMI figure to 51.2, not 51.3)