Japan lost its status as the world's third-largest economy to Germany last year and it unexpectedly slipped into recession in the final quarter of 2023 due to weak domestic demand, government data showed Thursday.

Japan's nominal gross domestic product, not adjusted for inflation, totaled $4.21 trillion, the world's fourth-largest after Germany's $4.46 trillion, largely because of the yen's sharp drop.

The United States retained the top spot, followed by China, which overtook Japan as the second-largest economy over a decade ago.

For the October-December period, the economy shrank 0.1 percent from the previous quarter, or at an annual rate of 0.4 percent, with spending by both households and businesses lacking vigor amid entrenched inflation, according to the Cabinet Office.

Two straight quarters of contraction meant the economy was in a technical recession, posing a challenge for the government and the Bank of Japan as they seek to achieve domestic demand-led growth accompanied by rising wages.

Private-sector economists polled by the Japan Center for Economic Research had forecast an annualized 1.28 percent expansion. GDP is the total value of goods and services produced in a country.

"The problem is not just that Japan reported negative growth. Domestic demand also collapsed and the data was extremely bad," said Toru Suehiro, chief economist at Daiwa Securities Co., calling the outcome a "negative surprise" for markets.

"It came despite (support from) COVID-related pent-up demand last year. By the time real wages start to recover, there won't be euphoria," he said, adding that the BOJ will still move to end its negative rate policy this spring as expected by financial markets.

Japan's economic decline has become more apparent in recent decades. The country enjoyed high growth in its post-World War II period, but its malaise began with the bursting of the asset bubble in the early 1990s and it has since been plagued by deflation.

Japan lost its spot as the world's second-largest economy to China in 2010. Its growth has remained modest and domestic demand weak, even with the help of unprecedented monetary easing by the BOJ.

Private consumption, which makes up more than half of the economy, dropped 0.2 percent, marking the third straight quarter of decline, as households have been grappling with the rising cost of living and falling real wages.

Capital spending also lacked strength, down 0.1 percent, in a worrying sign that Japanese firms remain cautious about ramping up investment despite their robust plans.

Nominal GDP increased 0.3 percent in the October-December quarter, or at an annual rate of 1.2 percent.

"Germany overtaking Japan shows it is imperative for us to promote structural reforms and create a new stage for growth," economy revitalization minister Yoshitaka Shindo told a press conference.

"We will deploy all policy steps to support pay hikes" to clear the way for sustainable, demand-driven economic growth, he added.

Despite soft domestic demand, exports continued to grow, up 2.6 percent, helped by a revival of inbound tourism. Spending by foreign visitors to Japan is treated as exports in the GDP data.

While concerns about a global slowdown have persisted, the U.S. economy has been resilient despite the Federal Reserve aggressively raising interest rates. Increased U.S.-bound auto shipments lent support to the Japanese economy last year.

Public investment decreased 0.7 percent, down for the second straight quarter, the data showed.

On a yearly basis, Japan's economy grew 1.9 percent in real terms and 5.7 percent in nominal terms.

Related coverage:

China announces bank reserve ratio cut to shore up slowing economy

China's 2023 GDP grows 5.2% to meet annual target, outlook bearish

Over 70% of firms expect Japan economy to keep growing in 2024