The U.S. trade deficit narrowed more than expected in June as petroleum imports dropped to a 3-1/2 year low, suggesting that trade was less of a drag on second-quarter economic growth than initially thought.

The Commerce Department said on Wednesday the trade gap dropped 7.0 percent to $41.5 billion, the lowest reading since January. May's trade deficit was revised up to $44.7 billion.

Economists polled by Reuters had expected the deficit to widen slightly to $44.7 billion in June from a previously reported $44.4 billion shortfall in May.

When adjusted for inflation, the deficit narrowed to $48.8 billion from $52.0 billion in May.

June's overall trade deficit was far smaller than what the government had assumed in its first snapshot of second-quarter gross domestic product published last week. That suggests the GDP growth estimate for the quarter could be revised up.

Trade subtracted 0.61 percentage point from growth in the April-June period. The economy expanded at a 4.0 percent annual rate during that quarter after shrinking 2.1 percent in the first three months of the year.

In June, imports fell 1.2 percent, the largest drop in a year, to $237.4 billion. That came as petroleum imports declined to $27.4 billion, the lowest level since November 2010, from $28.3 billion in May.

A domestic energy boom has seen the country reduce its dependence of foreign oil, helping to ease pressure on the current account deficit. In June, the petroleum deficit fell to is lowest level since May 2009.

While non-petroleum imports fell to $167.6 billion from $169.6 billion in May, food imports hit a record high.

In June, exports edged up 0.1 percent to a record high of $195.9 billion. Exports were supported by a surge in automobiles, parts and engines, which rose to a record high. Exports of consumer goods were also the highest on record.

Rising exports bode well for economic growth prospects for the rest of the year. Exports to Canada hit an all-time high in June. Exports to China rose 1.4 percent, while imports from that country increased 3.7 percent.

That left the politically sensitive trade gap with China at $30.1 billion, up 4.5 percent from May.