The U.S. trade deficit increased to a five-month high in July as exports of soybeans and civilian aircraft declined and imports hit a record high, suggesting that trade could be a drag on economic growth in the third quarter.

The increase was the biggest monthly widening since 2015.

The Commerce Department said on Wednesday the trade gap jumped 9.5 percent to $50.1 billion, widening for a second straight month. Data for June was revised to show the trade deficit rising to $45.7 billion, instead of the previously reported $46.3 billion.

The politically sensitive goods trade deficit with China surged 10 percent to a record $36.8 billion.

Economists polled by Reuters had forecast the overall trade deficit swelling to $50.3 billion in July. The trade gap continues to widen despite the Trump administration’s “America First” policies, which have left the United States embroiled in tit-for-tat tariffs with the European Union, Canada and Mexico as well as an escalating trade war with China.

President Donald Trump has defended the duties on steel, aluminum imports and a range of Chinese goods as necessary to protect American industries from what he says is unfair foreign competition.

The administration says eliminating the trade deficit will put the economy on a sustainable path of faster growth, an argument that has been dismissed by economists as flawed given constraints such as low productivity and slow population growth.

The United States and China have slapped retaliatory tariffs on a combined $100 billion of products since early July, with more in the pipeline, posing risks to both domestic and global economic growth.

The trade gap narrowed in April and May as farmers front-loaded soybean exports to China before Beijing’s retaliatory tariffs came into effect in early July.

When adjusted for inflation, the trade gap increased to a five-month high of $82.5 billion in July from $79.3 billion in June. July’s so-called real trade deficit is above the second-quarter average of $77.5 billion. If that trend continues in August and September, trade could subtract from third-quarter gross domestic growth.

Trade contributed 1.17 percentage points to the economy’s 4.2 percent annualized growth pace in the second quarter.

In July, the trade gap with Mexico narrowed 25.3 percent to $5.5 billion while the shortfall with Canada shot up 57.6 percent to $3.1 billion. The trade deficit with the European Union soared 50 percent to a record high of $17.6 billion.

In July, exports of goods and services fell 1.0 percent to $211.1 billion. Soybean exports dropped $0.7 billion and shipments of civilian aircraft decreased $1.6 billion. Petroleum exports, however, were the highest on record.

Imports of goods and services increased 0.9 percent to a record $261.2 billion in July. They were boosted by imports of computers and computer accessories. The import bill was also inflated by petroleum imports, which were the highest since December 2014. The surge reflected higher oil prices.

The price of imported crude oil averaged $64.63 per barrel in July, up from $62.42 in June. There were also increases in imports of automobiles and parts as well as other goods. Pharmaceutical preparations imports, however, fell $1.3 billion.

CNBC contributed to this report.