The U.S. trade deficit narrowed in July to its lowest point in six months as exports rose to a record high, supporting views of sturdy economic growth in the third quarter.

The Commerce Department said on Thursday the trade gap fell 0.6 percent to $40.5 billion, the lowest since January. June's trade deficit was revised to $40.8 billion.

Economists polled by Reuters had expected the deficit to widen to $42.2 billion in July from a previously reported $41.5 billion shortfall in June.

When adjusted for inflation, the deficit narrowed to $48.2 billion, the lowest since December 2013, from $48.9 billion in June, which could see economists raise their estimates for third quarter gross domestic product.

Trade weighed on growth in the April-June period.

Exports increased 0.9 percent to a record high of $198.0 billion in July, supported by a surge in goods, automobiles, parts and engines, as well as non-petroleum products.

Imports rebounded 0.7 percent in July to $238.6 billion after declining in June. The rebound in imports is a sign of underlying strength in domestic demand.

The increase in imports was driven by food and autos, which both hit record highs.

Petroleum imports declined, which saw the petroleum deficit hitting its lowest level since May 2009. A domestic energy boom has seen the United States reduce its dependence on foreign oil.

The politically sensitive trade gap with China was the highest on record in July. (Reporting by Lucia Mutikani; Editing by Paul Simao)