TOKYO -- Japan's economy unexpectedly grew in the first quarter, giving Prime Minister Shinzo Abe some momentum to go ahead with his plan to raise the country's consumption tax this fall.

Gross domestic product for the quarter expanded at an annualized rate of 2.1%, preliminary figures released by the Cabinet Office showed on Monday, much better than the 0.2% contraction forecast by economists in a Reuters poll.

The gain was attributed to positive net exports and an increase in government spending, which offset weaker private investment and personal consumption. This follows a 1.6% expansion in the previous quarter and marks Japan's fastest growth rate since the April-June term of 2018.

Shortly after the figures were released, Economic Revitalization Minister Toshimitsu Motegi told reporters that "there is no change in the idea of raising [the consumption tax] in October" to 10%, from 8%.

Marcel Thieliant, senior Japan economist for Capital Economics, said the economy's "surprising resilience" suggests Abe will follow through with the tax increase.

Masamichi Adachi at JPMorgan Securities Japan agreed. "We now see lower probability of the postponement of the scheduled hike in October to less than 30%, from 30-40% we had thought before the release" of the GDP.

Yet, a closer look at the figures reveals that a continued economic recovery is far from certain.

The biggest factor behind the first-quarter result was the net export balance -- total exports minus imports. Exports fell 2.4% from the previous quarter, but imports dropped 4.6%, resulting in a net positive contribution of 0.4%. The larger-than-expected decline in imports, however, is an indicator of sluggish domestic demand.

"The weakness of the domestic economy pushed up the headline GDP figures," said Tsuyoshi Ueno, senior economist at the NLI Research Institute in Tokyo.

Private consumption fell 0.1%, compared with a 0.2% increase in the previous quarter. Meanwhile, private nonresidential investment fell 0.3%, compared with a 2.5% increase in the previous period.

Some surveys suggest corporate sentiment is improving, but that may change with signs of growing uncertainty over the trade battle between the U.S. and China -- Japan's two largest trading partners.

Another contributor to the overall GDP figure was the 1.5% growth in public spending, the first positive growth in five quarters. Economists say the government has been spending more on disaster-related public works projects.

A container terminal in Tokyo: A net export gain helped offset weaker consumption in the first quarter. © Reuters

But there is little room to keep ramping up spending given the huge public debt load, which is more than double GDP.

A recent survey of international economists forecast a severe downturn for Japan in the second quarter.

The Munich-based Ifo Institute put Japan in the recession section of its "business cycle clock" for the first time since July-September 2016, based on about 1,300 responses from around the world.

However, markets were little moved by the data. The Nikkei Stock Average rose about 100 points before dropping to close morning trading about 58 points up at 21,307.84.