Japan's merchandise exports and imports both hit record highs in December on the back of stronger demand for cars and higher energy prices, government data showed Thursday.

Exports jumped 17.5 percent from a year earlier to 7.9 trillion yen ($69 billion), up for the 10th straight month, while imports surged 41.1 percent to 8.5 trillion yen, up for the 11th consecutive month, according to preliminary data released by the Finance Ministry.

As a result, Japan marked a goods trade deficit of 582.4 billion yen in December, for the fifth straight month of red ink.

While the Omicron variant of the coronavirus spread rapidly in Europe and the United States in the reporting month, the impact on Japan's exports to such countries was limited, economists said.

"Amid the pandemic, demand has decreased for services but increased for goods" such as for home appliances due to more people staying at home, said Takeshi Minami, chief economist at the Norinchukin Research Institute.

"As Japan, Europe and the United States trade final goods, rather than parts, the spread of the Omicron variant had little effect on exports," he said.

The depreciation of the yen also helped to lift exports, Minami said, boosting repatriated profits from products sold overseas.

The Japanese currency weakened 9.5 percent against the U.S. dollar from a year earlier, trading at an average of 113.95 yen in December, according to the ministry.

By item, exports of automobiles rose 17.5 percent from a year earlier, while iron exports swelled 75.1 percent, as supply chain disruptions caused by the coronavirus pandemic gradually eased.

Japan's exports previously posted a record 7.7 trillion yen in March 2008.

In December, exports to China, Japan's biggest trading partner, climbed 10.8 percent to a record 1.7 trillion yen, rising for the 18th consecutive month, backed by robust demand for semiconductor-related parts and cars.

Shipments to the United States grew 22.1 percent to 1.5 trillion yen, increasing for the third straight month.

The weaker yen resulted in higher import prices for Japan, with crude oil and liquefied natural gas prices more than doubling, up 116.6 percent and 100.5 percent, respectively. The value of coal imports soared 178.4 percent.

In the whole of 2021, exports rose 21.5 percent to 83.1 trillion yen, advancing for the first time in three years. Iron shipments contributed the most, increasing 48.1 percent.

Imports rose 24.3 percent, up for the first time in three years, to 84.6 trillion yen, with crude oil prices jumping 49.1 percent.

Trade with China saw record highs in value terms, with exports to the country rising 19.2 percent to 18.0 trillion yen, up for the second consecutive year, and imports from the country increasing 16.2 percent to 20.4 trillion yen for the first advance in three years.

Both the overall export and import figures were the second highest on record, translating into a goods trade deficit of 1.5 trillion yen, following a 388.3 billion yen surplus in 2020.

Looking ahead, economists said the spread of the Omicron variant in Southeast Asia should be carefully watched, amid concern over a repeat of the summer of 2021 when auto parts factories were closed for anti-virus measures.

"Government responses in countries such as Vietnam, Malaysia and Thailand that are key car parts suppliers are especially in focus," said Atsushi Takeda, chief economist of the Itochu Research Institute.

"But since countries have been implementing milder restrictions compared with those against the Delta variant infection surge, there are expectations that the impact on auto output will be limited," he said.