The U.S. economy expanded at a rate of 2.9 percent in the fourth quarter, the Commerce Department reported Wednesday, much better than Wall Street analysts expected and very close to President Trump’s goal of 3 percent growth.

The strong growth came largely from Americans spending more. Consumption accounts for about 70 percent of the U.S. economy, and as more Americans get jobs, they are able to buy more online and at stores. Businesses also boosted their spending at the end of last year, beefing up their inventories because executives expect sales to pick up. There was also more federal government spending, especially on defense, according to the report.

The government’s previous estimate for growth from October through December was 2.5 percent. The jump to 2.9 percent growth means the U.S. economy grew at an average pace of 3.1 percent from April through December of last year, a fact the Trump administration is likely to tout as evidence its economic policies are working.

Most economists, however, attribute the healthy growth last year to the rebounding global economy. At least 120 countries have seen a pickup in growth in the past year, according to the International Monetary Fund, a synchronized global upturn that hasn’t been seen since 2010.

“The message remains one of solid domestic activity in the fourth quarter, driven by household and business spending,” said economist Pooja Sriram at Barclays. “The synchronized nature of global growth is likely to support stronger business investment, faster export growth and higher imports of capital goods in the coming quarters.”

Growth is also expected to pick up even more this year as the Republican tax cuts are likely to encourage more consumer spending and prompt businesses to invest more in new equipment, factories, robots and additional workers. The consensus forecast for the pace of growth this year is 2.8 percent, with a number of forecasts thinking 3 percent is possible. Even the usually conservative Federal Reserve recently raised its forecast to a 2.7 percent rate of growth for 2018.

“The economic outlook has strengthened in recent months,” the Fed said last week.

But the biggest threat to growth is Trump’s trade policies. While the administration is cheering a fresh deal with South Korea on trade, executives and investors are closely watching what happens between the United States and China. The two countries are locked in negotiations, with both sides announcing tariffs and threatening more.

“The economy’s wheels were spinning faster than we thought in the fourth quarter,” said Chris Rupkey, chief financial economist at MUFG Union Bank. “Time will tell if Trump’s economics team can steer its way into the record books. It’s going to be quite a horse race as massive tax cuts help the cause, even as trade sanctions and America-first tariffs appear to hurt the cause for economic growth.”

The U.S. economy has been growing for more than eight years, already making this the third-longest expansion in U.S. history. It could easily become the longest ever, many economists say, beating out the 10-year stretch of growth from 1991 to 2001.