WASHINGTON — The U.S. trade deficit fell in July as imports declined slightly and exports rose to the highest level in 10 months, a possible sign that global demand for American products is starting to rebound.

The deficit declined to $39.5 billion, 11.6 percent lower than June’s $44.7 billion deficit, the Commerce Department reported Friday. Imports dropped 0.8 percent to $225.8 billion, reflecting in part lower oil imports. Exports climbed 1.9 percent to $186.3 billion, the highest level since last September, led by increased sales of American farm products.

The politically sensitive deficit with China increased 1.9 percent to $30.3 billion, the highest level since November. Republican presidential nominee Donald Trump has accused China of engaging in unfair trade practices which he says have cost millions of American jobs.

The trade deficit is the difference between what America exports for sale abroad and imports for consumption in the United States. A smaller deficit helps to boost overall economic growth because it bolsters domestic production. The deficit last year rose 2.1 percent to $500.4 billion, trimming 0.6 percentage point from overall growth of 2.6 percent in 2015. Growth this year is expected to be even slower given a weak start which has seen the economy barely expanding at an anemic rate of 1 percent in the first half of the year.

However, analysts believe growth will rebound in the second half as continued solid gains in employment help to boost consumer spending. They are looking for a declining trade deficit to support growth in the current quarter.

The rise in the deficit with China in July reflected higher imports of Chinese-made toys, clothing and cell phones.

President Barack Obama is traveling to China for a weekend summit of the Group of 20 major economic powers with administration officials saying Obama will press the other countries to do more to support global growth.

Even with the July increase, exports through the first seven months of this year are running 3.4 percent lower than the same period in 2015. American exporters have been struggling with a stronger dollar, which makes U.S. goods more expensive on overseas markets, and global economic weakness. But economists believe the drag from the dollar’s rise may be lessening.

Trump, seeking to tap into the economic anxiety of Americans who have seen jobs disappear in an increasingly global economy, has accused the Obama administration of failing to protect U.S. workers from unfair trade practices in China and other countries.

Trump has said he would exit from the North American Free Trade Agreement with Canada and Mexico if it is not improved and will kill the pending Trans-Pacific Partnership trade agreement between America and 11 Pacific Rim nations.

Both Trump and Democratic nominee Hillary Clinton have attacked the TPP agreement which the Obama administration negotiated and the president still hopes to get through Congress in a lame duck session after the November election.

While oil prices plunged at the beginning of the year, they have been rebounding more recently. The average price of a barrel of imported oil rose to $41.02 in July, its fifth consecutive monthly increase. However, even with the price gain, total oil imports dropped by 5 percent to $12.6 billion in July.

America’s deficit with the European Union fell 4.4 percent to $12.3 billion while the deficit with Mexico was down 11.7 percent to $4.7 billion.