TOKYO, Feb 27 (Reuters) - As economic and geopolitical woes spur an exodus of investors from China, many have been redirecting money into Japan, giving the benchmark Nikkei an extra boost as it rockets to all-time highs.

While some investors just want to say goodbye to Japan's troubled neighbour in embracing the land of the rising sun, paradoxically, those seeking to harness the two countries' close economic ties at a cozy distance are winning handsomely.

Nikkei heavyweights with a significant presence in China, such as chip giant Tokyo Electron and Uniqlo parent company Fast Retailing are soaring, having gained 126% and 63%, respectively, over the last 12 months.

ASICS Corp, which has subsidiaries in countries including China, is up about 91%, while Japanese restaurant chain Seizeriya, a popular chain that has made a mark in China, has climbed 62%.

Investors who have historically owned Chinese stocks but are now keeping a distance for fear of U.S. sanctions say owning a Japanese firm that either sells to China or is based there is becoming the more politically palatable option.

Others are betting on China's eventual recovery, either driven by its quest for self-sufficiency or improved spending by its 1.4 billion consumers.

Buying Japanese stocks is "less controversial in the U.S. political environment right now", said Liqian Ren, director of Modern Alpha at WisdomTree Asset Management in Philadelphia.

"If a client owns Japan, even though the exposure is China's kind of proxy, your client is much less likely to ask you a political question if the portfolio didn't perform as well," she said.

Japan's largest trade partner, China accounts for a fifth of trade and is also the third largest destination for Japanese investment, after the United States and Australia.

While the countries may be intertwined economically, their financial markets could not present a greater contrast.

China's blue-chip CSI300 index hit five-year lows this month, and is down 18% in about a year, pummeled by property market troubles and a lack of large-scale stimulus.

Japanese equities, on the other hand, are at record highs, and seem set to rise on the back of a brighter outlook for its economy and corporate governance reforms.

About $6.59 billion has flowed out of China offshore funds since April 2023, while Japanese offshore funds received $6.3 billion worth of inflows last month, adding to inflows of $7.84 billion last year, according to LSEG data.

Jamie Halse, a portfolio manager at Platinum Asset Management in Sydney, owns baby products maker Pigeon Corp .

The firm draws the majority of its operating profit from China, and Halse pointed to a rebound in the number of marriages on the mainland last year, which jumped 10%, following steady declines during the COVID-19 pandemic.

"The other major area is most of the semiconductor supply chain, which is heavily exposed to Chinese demand," Halse added. "It has been very robust recently."

Japan's chip-sector giants have helped to fuel the Nikkei's 17% gains this year, with Tokyo Electron and chip-testing equipment maker Advantest ranking among top performers.

"We are seeing a lot of flows in our hedge fund book globally coming out of China, and ... a lot is coming into the Japanese market," said Bruce Kirk, chief Japan equity strategist at Goldman Sachs.

Chinese ties can serve as a major buoy or bludgeon to Japanese companies. The earnings of Shiseido, a cosmetic firm banking on China's beauty market, were battered by the slowing economy and its shares have fallen 32% in a year.

Whether investors come to Japan seeking China proxies or complete disconnection, the shadows cast over China have given the Nikkei an undeniable boost.

Even companies with slim links to China, such as Recruit Holdings and Toyota Motor, are up sharply.

But in the end, analysts see fundamentals such as corporate governance reforms and earnings at index heavyweights as key to future inflows.

"The China replacement trade is like extra icing on the top," said WisdomTree's Ren. (Reporting by Brigid Riley; additional reporting by Tom Westbrook, Vidya Ranganathan and Rae Wee in Singapore; Editing by Vidya Ranganathan and Clarence Fernandez)