SINGAPORE, Feb 22 (Reuters) - The Nikkei's climb to within a whisker of a record high marks Japanese stocks' long walk out of the investment wilderness as money, momentum and signs of change in corporate Japan put the market back atop global portfolios.

It has been a long time coming: more than 34 years and long enough to scar a generation of Japanese investors, who through bitter experience have been sellers into this powerful rally.

With the Nikkei up 50% in just over a year, however, global managers are now feeling the pain of missing out and scrambling to get in.

Favourable valuations, buybacks and other market-friendly corporate decisions also have investors convinced there is no bubble this time around. Inflows are only getting started, say dealers and fund managers, and barely weeks into the year brokerage analysts have been revising price targets upwards.

"If I was going to put it terms of (a) baseball analogy, I think that we're still in the second inning," said Shinji Ogawa, co-head of Japan cash equities sales at J.P. Morgan in Tokyo.

"The number of incoming requests into my team are literally exponential the last few months – it's overwhelming how much demand or interest there is in Japan at the moment."

Ogawa estimates global managers would need to buy some 42 trillion yen ($280 billion) in stocks just to bring their exposure, which has dwindled over the decades, to market weight.

Global ex-U.S. stock funds are underweight Japan to the tune of 4%, according to data provider EPFR. Pacific regional funds are underweight Japan by 8%.

Flows suggest managers are narrowing that quickly as staying away gets harder to justify. Net foreign buying was 6.3 trillion yen ($41.94 billion) last year, the most on records stretching back a decade. In January, it was 1.2 trillion yen.

"Global (portfolio managers) were OK with not owning Japan for such a long time," said Shuntaro Takeuchi, who manages Japan strategies with about $800 million in assets at Matthews Asia, but now the performance is starting to apply pressure.

"They're off the hook until they're not."

BULLISH

The Nikkei's proximity to the milestone recalls the collapse that followed the previous peak, when Japan's "bubble economy" burst and the index dropped 60% in 2-1/2 years.

It also puts the lie to the myth that Japanese stocks are historic laggards.

On Thursday, the benchmark climbed as high as 38,924.88 in morning trade, above its record closing high and within 33 points of the 1989 record high of 38,957.44.

The recent surge is the latest in a strong run: over the past decade, the Nikkei is up 161% in yen terms and nearly 80% in dollar terms.

By comparison, over the same period, in dollars, the best performing major market in Europe, Germany's DAX, rose less than 40%. The Shanghai Composite climbed 18% in dollar terms in the 10 years to Feb. 2024. The S&P 500 is up about 170%.

Investors with long memories also point out differences in valuation and mindset this time.

In the late 1980s, Japanese stocks traded on price-to-earnings multiples in the 50s and beyond.

Now the Nikkei trades at a P/E ratio of 22 and the entire market capitalisation of the index - 680 trillion yen - is less than that of just Apple and Nvidia combined.

"In 1989, everybody and their brother was bullish, not just a bunch of foreigners," said Jesper Koll, global ambassador at brokerage Monex Group, who back then was chief economist at SG Warburg Securities Japan and has closely watched the market since.

"It was Japan itself that was convinced that nothing could go wrong, that Japan was going to take over the world. And that's obviously hugely different this time around."

Last year Japanese retail investors sold net 3.5 trillion yen in stocks and they sold another trillion in January. Japanese institutional investors sold 2.7 trillion in stocks in 2023 and 1.3 trillion in January.

FIFTY THOUSAND

Profits also help. Cash is streaming in to banks and corporate titans such as Toyota and Nippon Telegraph and Telephone.

Sales at Toyota, the world's top automaker, hit a record in 2023 and investors see earnings improvements continuing, even if the yen rises. Factory surveys point to even more profits ahead.

Simultaneously, the Tokyo Stock Exchange is prodding firms to improve lazy capital management, unwind inefficient cross-holdings and put cash to work or return it.

Total buybacks hit a record of almost $60 billion last year, according to LSEG data. But that's lower than Apple's stock repurchases and, with some 343 trillion yen in cash on non-bank balance sheets, investors expect more buybacks.

"They hold substantial cash ... the Japanese government is asking them to return that cash to shareholders - like a dividend but with extra kick," said Liqian Ren at WisdomTree Asset Management in Philadelphia.

Japan's stock dividend yield today is about 2% and seen rising, well up from 1989 when it was around 0.4% and the government bond yielded almost 6%.

To be sure, there are risks. Japan slipped into recession last quarter and the prospect of the first interest rates rise in decades and a wobbling Chinese economy also weigh.

But foreign buying, a lack of froth and a gradual shift in the global attitude toward Japan is promising, say veterans.

"Japanese stocks today ... are tremendously undervalued," said Ryoji Musha a veteran of Daiwa and Deutsche who turned sceptical in the late 1980s when valuations went sky high.

"The interest rate is 0.8%, compared to a stock return of 7%," he said, from the offices of his firm, Musha Research, overlooking Tokyo Bay.

"The Nikkei average could rise to about 50,000 yen by the end of the year." ($1 = 150.2100 yen)

(Reporting by Tom Westbrook in Singapore. Additional reporting by Vidya Ranganathan in Singapore, Tetsushi Kajimoto, Nobuhiro Kubo and Anton Bridge in Tokyo and by Gaurav Dogra in Bengaluru. Editing by Sam Holmes.)