WASHINGTON (Reuters) - The U.S. trade deficit narrowed slightly in July, but the gap with China, a focus of the Trump administration’s “America First” agenda, surged to a six-month high.

FILE PHOTO: Trucks offload containers from ship at the port of Los Angeles in Los Angeles, California, U.S. July 16, 2018. REUTERS/Mike Blake

The report from the Commerce Department on Wednesday came against the backdrop of an escalation in the trade war between the United States and China. The two economic giants slapped fresh tariffs on each other on Sunday, fanning fears of a global recession. President Donald Trump on Tuesday warned he would be “tougher” on Beijing in a second term if trade talks dragged on.

“Investors and the markets are unlikely to see any reprieve in the trade sanctions and tariffs and the Trump administration may even redouble their efforts to tame the massive red ink,” said Chris Rupkey, chief economist at MUFG in New York. “It doesn’t look like America is winning the trade war.”

The trade deficit dropped 2.7% to $54.0 billion as exports rebounded and imports fell. Economists polled by Reuters had forecast the trade gap narrowing to $53.5 billion in July. The monthly trade gap has swelled from $46.4 billion at the start of 2017, when Trump took over from former president Barack Obama.

The politically sensitive goods trade deficit with China increased 9.4% to $32.8 billion on an unadjusted basis, the highest since January, with imports jumping 6.4%. Exports to China fell 3.3% in July. Smoothing out seasonal fluctuations, the shortfall with China dropped 1.7% in July as both imports and exports dropped.

U.S. exports to China have declined 18.2% in the first seven months of this year and imports are down 12.3%, pointing to a restriction of trade flows between the two nations.

The trade deficit with the European Union raced to a record high in July, with the shortfall with Germany the largest since August 2015. This could draw more criticism from Trump, who last week complained “the euro is dropping against the dollar ‘like crazy,’ giving them a big export and manufacturing advantage.”

Washington on Sunday imposed 15% tariffs on more than $125 billion in Chinese imports, including smart speakers, Bluetooth headphones and clothing. In retaliation, China slapped additional duties on some of the U.S. goods on a $75 billion target list, including a 5% tariff on crude oil. Additional tariffs are due in December.

The trade tensions have rattled financial markets and triggered a global manufacturing recession. The trade-driven downturn in manufacturing is threatening the longest U.S. economic expansion in history.

A separate report from the Federal Reserve on Wednesday described the economy as having expanded at a “modest” pace through the end of August amid concerns over tariffs and trade policy uncertainty.

The dollar fell against a basket of currencies, while U.S. Treasury prices rose. Stocks on Wall Street were trading higher after upbeat data from China’s services sector.

EXPORTS REBOUND

In July, goods exports increased 0.9% to $138.2 billion. But with China imposing additional tariffs on U.S. soybeans, beef and pork, exports are likely to decline in the months ahead. China’s commerce ministry said in early August that Chinese companies had stopped buying U.S. farm products.

A survey of manufacturers on Tuesday showed a measure of export orders received by factories plummeted in August to the lowest level since April 2009.

In July, exports were boosted by consumer goods, which increased $1.5 billion. Capital goods exports rose $0.8 billion. There were also increases in exports of motor vehicles. Exports of industrial supplies and materials, however, decreased $1.7 billion, with shipments of crude oil falling $0.5 billion.

“A soft export and capital spending environment, in large part resulting from trade policy turmoil, are likely important factors contributing to the weakness in manufacturing,” said John Ryding, chief economist at RDQ Economics in New York.

Goods imports dropped 0.2% to $211.8 billion. Economists believe imports rebounded in August as businesses probably stocked up on Chinese goods following the announcement of further tariffs.

The U.S.-China trade tensions 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 import bill was pulled down by a $1.5 billion decline in capital goods imports, to the lowest level since October 2017. The drop in capital goods imports suggests business investment could remain weak in the third quarter after contracting in the April-June period for the first time in three years.

But imports of industrial supplies and materials rose $0.9 billion, with petroleum products imports increasing $1.0 billion. Imports from the European Union were the highest on record in July.

When adjusted for inflation, the goods trade deficit fell $0.7 billion to $85.5 billion in July. The so-called real trade deficit is slightly above the second-quarter average, suggesting trade could again weigh on gross domestic product this quarter.

Trade subtracted 0.72 percentage point from GDP in the second quarter. The economy grew at a 2.0% annualized rate in the last quarter, slowing from the first quarter’s brisk 3.1% rate. The Atlanta Federal Reserve is forecasting the economy growing at a 1.5% pace in the third quarter.

“The weakening in export orders in the manufacturing ISM report for August raises the likelihood that the data for the quarter as a whole will be weaker,” said Jim O’Sullivan, chief U.S. economist at High Frequency Economics in White Plains, New York.

In July, the services surplus decreased $0.1 billion to $19.7 billion, the lowest level since February 2016, as imports of services hit a record high.