WASHINGTON (Reuters) - U.S. economic growth accelerated in the first quarter, but the burst in growth was driven by a smaller trade deficit and the largest accumulation of unsold merchandise since 2015, temporary boosters that are seen weighing on the economy later this year.

The surge in growth reported by the Commerce Department on Friday put to rest fears of a recession, that were stoked by a brief inversion of the U.S. Treasury yield curve in March. But it also exaggerates the health of the economy as consumer and business spending slowed sharply, and investment in homebuilding contracted for a fifth straight quarter.

Gross domestic product increased at a 3.2 percent annualized rate in the first quarter, the government said in its advance GDP report. Growth was also driven by increased investment in roads by local and state governments.

“The gain in first-quarter GDP would seem to make a mockery of claims that the U.S. economy is slowing as the fiscal stimulus fades,” said Paul Ashworth, chief U.S. economist at Capital Economics in Toronto. “Looking beyond the headline number, however, there are plenty of causes for concern.”

The economy grew at a 2.2 percent pace in the October-December period. Economists polled by Reuters had forecast GDP increasing at a 2.0 percent rate in the first three months of the year. The economy will mark 10 years of expansion in July, the longest on record.

President Donald Trump cheered the economy’s performance in the first quarter. “This is far above expectations or projections,” Trump tweeted.

The White House has sought to boost growth through an array of policies, including a $1.5 trillion tax cut package passed in December 2017. Economists believe the fiscal stimulus, which also included more government spending, peaked in the third quarter.

They expect GDP to slow this year, with annual growth forecast around 2.5 percent, below the Trump’s administration’s 3 percent target. The economy missed the growth target in 2018.

Excluding trade, inventories and government spending, the economy grew at only a 1.3 percent rate in the first quarter, the slowest since the second quarter of 2013. This measure of domestic demand increased at a 2.6 percent pace in the October-December quarter.

A gauge of inflation tracked by the Federal Reserve increased at a 1.3 percent rate last quarter. Fed policymakers are likely to shrug off the last quarter’s growth spurt and focus on the weak domestic demand and inflation when they meet next week.

The U.S. central bank recently suspended its three-year monetary policy tightening campaign, dropping forecasts for any interest rate increases this year. The Fed raised borrowing costs four times in 2018.

“The Fed will focus on the composition of growth, which points to a slowing trend amid softening inflation,” said Joe Brusuelas, chief economist at RSM in New York. “This data reinforces the prudent pause the Fed is engaged in.”

The dollar dropped against a basket of currencies as investors fretted over the weak details of the GDP report. U.S. Treasury prices rose, while stocks on Wall Street were mixed.

BUSINESS SPENDING STALLS

Exports surged and imports declined in the first quarter, leading to a small deficit that added 1.03 percentage points to GDP after being neutral in the fourth quarter. Trade tensions between the United States and China have caused wild swings in the trade deficit, with exporters and importers trying to stay ahead of the tariff fight between the two economic giants.

The standoff has also had an impact on inventories, which increased at a $128.4 billion rate in the first quarter, the strongest pace since the second quarter of 2015. Inventories increased at a $96.8 billion pace in the October-December quarter. Part of the inventory build was because of weak demand, especially in the automotive sector, which is expected to weigh on future production at factories.

Inventories contributed 0.65 percentage point to first-quarter GDP after adding one-tenth of a percentage point in the October-December period.

Growth in consumer spending, which accounts for more than two-thirds of U.S. economic activity, slowed to a 1.2 percent rate from the fourth quarter’s 2.5 percent rate. The moderation in spending reflected a decline in motor vehicle purchases and other goods, likely related to a 35-day shutdown of the federal government. There was also a slowdown in spending on services.

The government said the shutdown had subtracted three-tenths of a percentage point from GDP last quarter. Retail sales have since rebounded strongly, pointing to some acceleration in consumption in the second quarter.

FILE PHOTO: An aerial photo looking north shows shipping containers at the Port of Seattle and the Elliott Bay waterfront in Seattle, Washington, U.S. March 21, 2019. REUTERS/Lindsey Wasson

“Momentum in consumer spending picked up toward the end of the first quarter, which augurs well for a better consumption outcome in the second quarter,” said Michael Feroli, an economist at JPMorgan in New York. “Even so ... we continue to expect GDP growth to step down to a 2.25 percent pace in second quarter.”

Business spending on equipment braked sharply, rising at only at a 0.2 percent rate, the slowest since the third quarter of 2016. Spending was held down by weak outlays on agricultural machinery and office furniture. Investment in structures contracted for a third straight quarter.

Residential construction fell at a 2.8 percent rate, marking the fifth straight quarterly decline. Government investment rebounded at a 2.4 percent rate, driven by spending at state and local governments. Federal government spending was flat.