WASHINGTON, Aug 5 (Reuters) - The U.S. trade deficit rose to a 10-month high in June as rising domestic demand and higher oil prices boosted the import bill while the lagging effects of a strong dollar continued to hamper export growth.

Cargo containers sit idle at the Port of Los Angeles as a back-log of over 30 container ships sit anchored outside the Port in Los Angeles, California, February 18, 2015. REUTERS/Bob Riha, Jr.

The Commerce Department said on Friday the trade gap increased 8.7 percent to $44.5 billion in June, the biggest deficit since August 2015. May’s trade deficit was revised slightly down to $41.0 billion.

June marked the third straight month of increases in the deficit. Economists polled by Reuters had forecast the trade gap widening to $43.1 billion in June after a previously reported $41.1 billion shortfall. When adjusted for inflation, the deficit rose to $64.7 billion from $60.9 billion in May.

The government in its snapshot of second-quarter gross domestic product published last week said trade had contributed two-tenths of a percentage point to the 1.2 percent annualized growth pace during the period.

The dollar’s sharp rally against the currencies of the United States’ main trading partners between June 2014 and December 2015 has undercut export growth.

With the dollar weakening this year on a trade-weighted basis, some of the drag on exports had started to ebb. But the dollar has been regaining strength in the wake of Britain’s June 23 vote to leave the European Union, and economists say that could renew pressure on exports.

Exports of goods and services edged up 0.3 percent in June.

Exports to the European Union jumped 7.8 percent, with goods shipped to the United Kingdom soaring 18.2 percent. China bought more U.S.-made goods in June, with exports to that country rising 3.6 percent.

Imports of goods and services increased 1.9 percent to $227.7 billion in June, with oil prices accounting for part of the rise. Oil prices averaged $39.38 per barrel in June, the highest level since October of last year, from $34.19 in May.

The $5.19 increase in the average oil price in June from May was the biggest since May 2011.

June’s increase in imports also reflected a pickup in domestic demand. Imports from China increased 2.8 percent. With imports outpacing exports, the politically sensitive U.S.-China trade deficit rose 2.5 percent to $29.8 billion in June, the biggest gap since last November.