Asian shares eked out modest gains for the second consecutive day on Thursday after the Federal Reserve offered a cautiously optimistic view of the U.S. economy, while oil prices edged higher on growing tensions in the Middle East.

Japanese shares <.N225> led gains in the region, rising to a fresh 9- month peak, boosted by healthy corporate earnings, strong inflows from foreign investors and gains on Wall Street. <.N>

The Nikkei ended up 0.3 percent, with the broader Topix index <.TOPX> up 0.7 percent. <.T>

Stocks in most of Asia ex-Japan also edged higher with buying across the materials, consumers and the energy sectors, though benchmark indexes fell in Singapore <.FTSTI> and South Korea <.KS11>, where the government unveiled cash support for troubled saving banks.

The MSCI's index of Asia Pacific shares outside Japan <.MIAPJ0000PUS> was up 0.2 percent, moving further away from a two-month low tested last Friday.

Japanese shares have gained some 6 percent this year, making it the best-performing Asian market so far in 2011, while Asian stocks outside Japan <.MIAPJ0000PUS> are down more than 2 percent as worries about growing inflationary pressures prompt foreign investors to rotate money out of emerging economies.

While Asian central banks have scrambled to tighten policy, some countries are still perceived to be falling behind in fighting inflation, making investors cautious about adding exposure to these markets even though recent steep drops have made valuations more attractive.

Emerging market tightening is falling short of what needs to be done due to concerns that higher rates will lead to currency strength, Brown Brothers Harriman strategists said in a note.

As such, more and more EM countries are being viewed as behind the curve and so the current period of EM underperformance could continue until more signs are seen they are getting back ahead of the curve.

Halfway through the first quarter of 2011, the worst performing markets within the region are India, Philippines, Thailand and Indonesia though indications show that some of them may be nearing a floor for now.

Much of the outflows from these countries have gone into developed markets, which have also benefited from a steady flow of encouraging economic data and robust corporate earnings.

Minutes of the Fed's Jan 25-26 policy session on Wednesday showed officials were more confident on economic recovery, though the job market recovery remained a concern.

Japan has been one of the big beneficiaries of these flows with overseas investors net buyers of Japanese stocks last week for the 15th straight week, the longest buying streak since late 2005/early 2006, according to latest data.

Asia equity ETF redemptions slowed to just $55 million last week after averaging $369 million in the previous three weeks while local buying in India was the biggest since late 2009, data from Trim Tabs Investment Research showed, indicating some of the selling may have run its course.

OIL RISES

Brent crude hovered near 2- year highs at just under $104 a barrel and U.S. crude for March delivery flirted with the $85 mark as anti-government protests spread in the Middle East and on news that Iranian warships were en route to Syria.

The rising tensions also pushed gold and U.S. Treasuries, typical safe-haven assets, higher, after Israel hinted at a possible response to Iran's move.

The benchmark 10-year U.S. note rose 3/32 in price to yield 3.61 percent, down about a basis point from late U.S. trade on Wednesday. The yield remained below a peak of 3.77 percent hit last week, its highest since April.

In the currency markets, the dollar ran out of steam versus the yen after hitting an eight-week peak of 83.98 yen on Wednesday as the Fed's minutes also showed the bank remained unhappy with the job market's recovery.

But traders said the greenback's weakness, especially against the euro is likely limited as the euro suffered from lingering worries over debt.

I don't think we'll see a clear trend in either direction for the time being, said a trader at a Japanese brokerage.

(Additional reporting by Umesh Desai, Antoni Slodkowski and Hideyuki Sano in TOKYO)

(Editing by Kim Coghill)