The U.S. economy, which only recently was flashing warning signs of a sharp slowdown, should finish the year in better shape, thanks to rate cuts from the Federal Reserve and a cease-fire in the U.S.-China trade war.

The Commerce Department said Friday that the gross domestic product, the economy’s total output of goods and services, grew at a moderate annual rate of 2.1% in the third quarter.

That was unchanged from the government’s previous estimate for activity in the July-September quarter although some of the components were revised. Consumer spending, which accounts for 70% of economic activity, grew at a stronger 3.2% pace, reflecting more spending on personal services such as beauty care, up from a previous estimate of 2.9% growth.

This boost was offset by a weaker reading for business inventory restocking.

Economists, who had been worried growth might all but disappear in the current October-December quarter, now believe the GDP is growing around 2% in the current quarter as well and are looking for that moderate pace to be sustained in the early part of 2020.

While 2% growth is below the gains of 3%-plus growth President Donald Trump has promised, it is far better than the recession many analysts feared could occur just a few months ago when financial markets were being roiled by rising tensions in the U.S.-China trade dispute and a global economic slowdown.

For all of 2019, the expectation is GDP growth will come in at 2.3%, down from the 2.9% gain achieved in 2018, the best since 2015. For 2020, analysts believe growth will slow further to 1.8% as the boost from the $1.5 trillion tax cut measure passed in 2017 fades further.

The economy is getting help from a phase one trade deal announced last week that should cool tensions between the United States and China. That announcement has helped push stock markets to new highs with rising optimism helped by better economic data of late. The economy gained 266,000 jobs in November with unemployment at a half-century low of 3.5%.

Three rate cuts by the Fed this year, after four rate hikes last year, has helped fuel the rebound and a budget agreement passed this week is expected to shower billions of dollars in increased spending on the military and domestic programs in the coming year, helping to support growth.

But even with those gains, analysts are forecasting that growth will slow further in 2020, hurt by such factors as continued uncertainty about future trade negotiations with China, a temporary halt in production of Boeing’s troubled 737 Max.

Another headwind could be the 2020 presidential election which is expected to raise business anxiety about the future course of government policies given the sharp differences between Trump and his Democratic challengers.

“I think next year is shaping up to be a rather pedestrian economy,” said Mark Zandi, chief economist at Moody’s Analytics. “It will be creating enough jobs to avoid a recession but still job growth will be slowing compared to this year.”