By Lucia Mutikani

WASHINGTON (Reuters) -The U.S. trade deficit in goods widened to a record high in December amid a continued rise in imports, suggesting that trade likely remained a drag on economic growth in the fourth quarter.

But the report from the Commerce Department on Wednesday also showed an acceleration in the pace of inventory accumulation at retailers and wholesalers, which likely offset the impact on gross domestic product from the larger trade gap.

“Strong demand and shifting consumer preferences during the pandemic led to a surge in imports that continues to outstrip exports and is contributing to all-time highs in the deficit,” said Rubeela Farooqi, chief U.S. economist at High Frequency Economics in White Plains, New York.

The goods trade deficit rose 3.0% to an all-time high of $101.0 billion last month. The trade gap is likely to remain large for a while as business continue to replenish depleted inventories.

Goods imports increased 2.0% to $258.3 billion, likely as the backlog at ports continued to be cleared. The increase in imports was driven by capital goods, motor vehicles and consumer goods. But imports of food and industrial supplies declined.

Goods exports rose 1.4% to $157.3 billion. There were increases in exports of consumer goods, industrial supplies and motor vehicles. Capital goods exports also rose, but food exports tumbled.

The report was published ahead of Thursday’s advance fourth-quarter GDP data. Trade has subtracted from GDP growth for five straight quarters.

According to a Reuters survey of economists, the economy likely grew at a 5.5% annualized rate last quarter, an acceleration from the third quarter’s 2.3% pace.

Inventory investment likely accounted for much of the anticipated acceleration in GDP growth last quarter. Growth last year is expected to have been the strongest since 1984.

The Commerce Department report showed retail inventories shot up 4.4% in December after increasing 2.0% in November. Inventories of motor vehicles and parts jumped 6.8% after rising 4.3% in November. They had been hampered by a global semi-conductor shortage, which has undercut motor vehicle production.

Retail inventories excluding motor vehicles accelerated 3.6% after rising 1.2% in November. This component goes into the calculation of GDP growth.

Inventories at wholesalers increased 2.1% last month after advancing 1.7% in November. There were increases in stocks of both durable and nondurable goods.

Inventory accumulation had been constrained by COVID-19-related global shortages, and the solid increases over the last two months offer hope that the worst of the supply chain disruptions was behind.

“It will likely take time for the supply-chain issues to ease, which could keep U.S. goods inflation elevated,” said Ryan Sweet, a senior economist at Moody’s Analytics in West Chester, Pennsylvania.

(Reporting by Lucia Mutikani; Editing by Andrew Heavens and Andrea Ricci)