Japanese factory output rose in January for a third straight month and manufacturers expect further gains in coming months, a sign that the economy is on track for a moderate export-driven recovery.

The data underscored the view by the government and the Bank of Japan that solid exports to Asia will underpin output and help the fragile economy to emerge from a lull soon.

But a spike in commodity costs triggered by unrest in the Middle East clouds the outlook, with some analysts worried about the damage it could inflict on corporate profits.

The Japanese economy is likely to continue to recover due to a rebound in exports, but the pace of export growth could slow somewhat after the spring, said Takahide Kiuchi, chief economist at Nomura Securities.

Oil prices will be a negative for Japan. The biggest concern is that this could hurt domestic demand.

Industrial output rose 2.4 percent in January, less than a median market forecast of a 4.0 percent increase, data from the Ministry of Economy, Trade and Industry showed on Monday.

Manufacturers surveyed by the ministry, however, expect output to edge up 0.1 percent in February and increase 1.9 percent in March.

INVENTORIES A WORRY

Strong demand for Japanese-made automobiles in Asia and Europe helped to drive output gains in January, lifting the output index to its highest since October 2008, but not quite to levels seen before the Lehman bankruptcy.

Still, the weaker-than-expected result suggests that the strong yen and strong regional competition combined with chronically weak domestic demand continued to weigh on output, said George Worthington, Asia economist at IFR Markets in Sydney.

Some analysts say a surge in inventories of consumer electronics and automobiles bodes ill for the outlook.

Domestic demand for those products has declined with the expiry of government stimulus measures to promote energy-efficient cars and appliances.

Inventories in January rose 4.7 percent, the largest gain since comparable data became available in 2003, indicating that companies could face increased pressure to adjust stocks in coming months.

Japan's economy shrank slightly in the final quarter of last year, hurt by the expiry of government incentives for car purchases and a slowdown in exports, but is expected to resume growing in the current quarter as exports pick up.

Underscoring the cautious optimism, Japanese manufacturing activity expanded at the fastest pace in eight months due to export demand, a survey showed on Monday.

The survey also showed input prices were at their highest in more than two years in an ominous sign for profits at companies unable to pass on costs to customers amid persistent deflation.

Rises in commodity prices are a big risk factor. If they continue to rise, that would hike costs. Our main scenario is for the price increases to settle down, but it's a risk factor, said Tatsushi Shikano, senior economist at Mitsubishi UFJ Morgan Stanley Securities.

Still, the firm factory output data underscores the dominant market view that the BOJ will hold off on easing monetary policy further, although it is also unlikely to shift away from its ultra-easy policy bias any time soon.

The BOJ cut interest rates virtually to zero last October and pledged to keep them there until core consumer inflation of 1 percent appears on the horizon.

While the spike in commodity costs may push consumer prices near that level earlier than expected, the central bank is set to stand pat on policy unless it sees clear evidence that the rise in prices is driven by a pickup in domestic demand.

(Writing by Leika Kihara; Editing by Edmund Klamann)