WASHINGTON (Reuters) - The U.S. economy grew at its fastest pace in nearly four years in the second quarter as consumers boosted spending and farmers rushed shipments of soybeans to China to beat retaliatory trade tariffs before they took effect in early July.

President Donald Trump, who ahead of Friday’s release of the gross domestic product report had promoted the notion that second-quarter growth would be robust, declared victory.

“We have accomplished an economic turnaround of historic proportions,” Trump told reporters. “These numbers are very, very sustainable.”

Gross domestic product increased at a 4.1 percent annualized rate also as government spending picked up, the Commerce Department said in its snapshot of second-quarter GDP. While that was the strongest performance since the third quarter of 2014, it was not the best since the recession ended in mid-2009.

January-March quarter GDP growth was revised up to a 2.2 percent pace from the previously reported 2.0 percent rate to account for updated information and methodology improvements.

Compared to the second quarter of 2017, the economy grew 2.8 percent. Output expanded 3.1 percent in the first half of 2018, putting the economy on track to hit the Trump administration’s target of 3 percent annual growth. A measure of domestic demand surged at a 4.3 percent rate in the second quarter.

Contrary to Trump’s assertions, the economy enjoyed periods of robust growth during the Obama administration. GDP growth recorded a 5.1 percent pace in the second quarter of 2014 and the economy experienced four quarters of output above a 4.0 percent rate.

Economists also cautioned against putting much weight on the surge in second-quarter growth as one-off factors, including a $1.5 trillion tax cut package, were behind the growth spurt. The soybean boost is likely to reverse in the coming quarters and the fiscal stimulus is seen fading in 2019.

“Pop the champagne today, but don’t get used to it, growth going forward has a lot of headwinds,” said Chris Rupkey, chief economist at MUFG in New York. “Unless you cut taxes again, there won’t be additional tax cut monies to line company and consumer pocket books.”

The United States slapped 25 percent duties on $34 billion worth of Chinese goods effective July 6, provoking a similar response from Beijing, which targeted soybeans and other agricultural products as well as U.S.-made cars.

Trump has also imposed tariffs on steel and aluminum imports, leading to retaliation by the United States’ main trade partners, including Canada, the European Union, Mexico and China.

Strong growth in the April-June quarter likely keeps the Federal Reserve on course to raise interest rates two more times this year. The U.S. central bank increased borrowing costs in June for the second time this year and forecast two more rate hikes for 2018.

The GDP report showed the Fed’s preferred inflation gauge, the personal consumption expenditures (PCE) price index excluding food and energy, increased at a 2.0 percent rate in the second quarter. The core PCE price index rose at a 2.2 percent pace in the January-March period.

FILE PHOTO - A shopper walks down an aisle in a newly opened Walmart Neighborhood Market in Chicago in this September 21, 2011 file photo. REUTERS/Jim Young/Files

The dollar was little changed versus a basket of currencies. U.S. Treasury yields fell and stocks on Wall Street were down.

GROWTH SEEN SLOWING

While trade war fears helped to boost output last quarter, import duties are seen undercutting economic growth, with higher prices for goods discouraging consumer spending and businesses shelving investment plans. Economists in a Reuters poll earlier this week predicted that growth will slow notably from here.

“The spring quarter could be the high water mark for growth,” said Joel Naroff, chief economist at Naroff Economic Advisors in Holland, Pennsylvania. “That said, there is every reason to expect that growth in the second half of the year will still be in the 3 percent range.”

Growth in consumer spending, which accounts for more than two-thirds of U.S. economic activity, increased at a 4.0 percent rate in the second quarter. That was the fastest in 3-1/2 years and followed the January-March period’s stall-speed pace of 0.5 percent.

Households bought motor vehicles and spent more on health care, utilities, food and accommodation in the last quarter.

Consumer spending is also being driven by a robust labor market, which created an average of 215,000 jobs per month in the first half of this year.

The front-loading of deliveries of soybeans and other goods boosted exports in the second quarter, which grew at their quickest pace in 4-1/2 years, sharply narrowing the trade deficit. Trade added 1.06 percentage points GDP growth in the second quarter after being neutral in the January-March period.

The rush to offload soybeans, however, depleted farm inventories. Inventories declined at a $27.9 billion rate after rising at a $30.3 billion pace in the first quarter. They subtracted 1.0 percentage point from GDP growth.

Business spending on equipment slowed and a further moderation is likely, with trade wars casting a pall on the business spending outlook.

General Motors Co, Ford Motor Co and Fiat Chrysler Automobiles NV on Wednesday cut their full-year profit forecasts, citing higher steel and aluminum costs.

Harley-Davidson Inc has warned that more expensive steel and aluminum and a 25 percent retaliatory duty imposed by the European Union on shipments from the United States could cost the motorcycle maker $45 million to $55 million this year.

Investment in homebuilding fell for a second straight quarter. Government spending grew solidly, boosted by defense outlays.