The Commerce Department said Wednesday that the trade gap rose 13 percent to $39.1 billion. That's up from June's deficit of $34.5 billion, which was the smallest since late 2009.
Imports increased 1.6 percent to $228.6 billion, lifted by more shipments of oil, autos and consumer goods. Exports slipped 0.6 percent to $189.4 billion. Companies shipped fewer capital goods, such as civilian aircraft and industrial engines.
A wider trade gap can slow economic growth because it means that U.S. consumers and businesses are spending more on foreign goods than U.S. companies are earning from overseas sales.
Still, the decline follows a steep drop in June. And economists noted that trade is running at roughly the same pace as the previous quarter. Many were also encouraged by the increase in imports of consumer products. That follows a weak government report last week on consumer spending in July.
Paul Ashworth, chief U.S. economist at Capital Economics, said that he expected trade would be "broadly neutral" in terms of overall economic growth in the second half of this year, not subtracting from growth or adding to it.
The lower deficit in June was fueled by the record level of exports, which helped boost overall economic growth to a 2.5 percent annual in the April-June quarter. Most analysts predict the economy will continued to grow at roughly a 2.5 percent annual rate in the second half of this year, helped by the stronger export market and less of a drag from government spending cuts and higher taxes.
In July, the deficit with China jumped to an all-time high of $30.1 billion and is slightly ahead of last year's record pace. That could increase pressure on the Obama administration to take a harder line on trade issues with China. American manufacturers contend China manipulates its currency and engages in other unfair practices to gain trade advantages over U.S. companies.
Europe's weak economy also is weighing on U.S. exports. The deficit with the 27-nation European Union jumped to a record $13.9 billion as imports from that region climbed 17.2 percent to a record $35.1 billion while U.S. exports to the region fell 7.4 percent to $21.1 billion.
Other reports suggest exports could rebound in August.
U.S. factories expanded in August at the fastest pace since June 2011, according to a closely watched survey released Tuesday from the Institute for Supply Management. The report said orders from overseas rose in August.
And a private survey of purchasing managers in China found that manufacturing in that country expanded for the first time after shrinking for three months.
The Federal Reserve is closely watching economic data to determine whether it should reduce its monthly bond purchases. Those purchases have been intended to keep long-term borrowing costs low.
Chairman Ben Bernanke has said the Fed could slow its $85 billion a month in bond buying later this year if the economy keeps improving. Some analysts think the Fed will announce after its next policy meeting Sept. 17-18 that it's scaling back the purchases.