U.S. business inventories increased slightly more than expected in July, suggesting that inventory investment could contribute to economic growth in the third quarter.

Inventories rose 0.4% after gaining 0.3% in June, the Commerce Department's Census Bureau said on Tuesday.

The increase in inventories, a key component of gross domestic product, was above economists' expectations for a 0.3% gain. Inventories increased 2.5% on a year-on-year basis in July.

Private inventory investment contributed to the economy's 3.0% annualized growth rate in the second quarter. There is hope that inventories could offset some of the drag on GDP from a widening trade deficit this quarter.

The trade gap has increased as businesses boosted imports likely in anticipation of higher tariffs on goods. Most of the imports could end up as unsold goods in warehouses.

Retail inventories increased 0.8% in July, as estimated in an advance report published last month. They rose 0.9% in June. Motor vehicle inventories advanced 1.3% instead of the previously reported 1.4%. They accelerated 2.1% in June.

Retail inventories excluding autos, which go into the calculation of GDP, rose 0.5%, as reported last month. They increased 0.3% in June.

Wholesale inventories climbed 0.2% in July, while stocks at manufacturers edged up 0.1%.

Business sales jumped 1.1% in July after being unchanged in June. At July's sales pace, it would take 1.37 months for businesses to clear shelves, down from 1.38 months in June.

(Reporting by Lucia Mutikani; Editing by Paul Simao)