(Bloomberg) -- South Korea’s equity benchmark flirted with bull market territory as a global investor frenzy for all things tied to artificial intelligence saw foreign funds accelerate purchases of the nation’s chipmakers.

An advance in the Kospi early Wednesday took its advance from a Sept. 30 low to 20%, before the gauge pulled back as weakening factory activity in China triggered broad weakness in Asia. The benchmark ended the day down 0.3%, but has still gained roughly 15% this year in one of the top performances in the region.

Heavyweight Samsung Electronics Co. has climbed nearly 40% since end-September and is the biggest contributor to gains on Korea’s benchmark. Purchases of chip stocks by global funds — who have returned to Korea’s market in 2023 after a three-year hiatus — have accelerated since Nvidia Corp. gave a bullish revenue outlook on booming demand for artificial intelligence processors just a few days back.

Goldman Sachs Group Inc. says the Kospi’s rally could continue as the semiconductor sector makes a potential recovery and foreign investors seek to build up positions. Meanwhile, a potential upgrade to the MSCI’s list of developed markets in late June is also helping draw more attention to South Korea, even as some analysts fear foreign outflows to be larger than inflows if it leaves the MSCI Emerging Markets Index.

READ: MSCI Upgrade Bid Risks Backfiring for South Korean Stock Market

“Foreign investors’ active love for semiconductors is driving the latest rally,” said Seo Sang Young, a strategist at Mirae Asset Securities. “There are expectations the chip sector will improve significantly as ChatGPT and Bard and others fuel growth and investment in the artificial intelligence industry.”

Overseas investors have been net buyers of more than $9 billion in Kospi shares so far in 2023. They have bought almost $8 billion worth of Samsung’s stock. Battery maker LG Energy Solution Ltd. and chipmaker SK Hynix Inc. are two other big contributors to Kospi gains. Companies related to the electric vehicle supply chain have seen some dizzying gains this year.

The Kospi’s rally is also a sharp contrast to the performance of equities in China, Korea’s biggest trading partner. A gauge of Chinese stocks listed in Hong Kong entered a bear market, as a weak economic recovery and tensions with the US continue to exert pressure. 

“We expected that the market would look through the very poor earnings this year,” Timothy Moe, chief Asia-Pacific equity strategist at Goldman Sachs, said about Korea’s market in an interview with Bloomberg TV on Wednesday.

Chipmakers aren’t the only sector lifting the Kospi. Automakers such as Hyundai Motor Co. and Kia Corp., as well as K-pop agencies including Hybe Co., have advanced at least 30% so far this year. Those stocks saw inflows of foreign funds amid expectations earnings will keep expanding as Korean cars and music garner more global popularity.

“From K-pop to other consumer brands, the national brand has become elevated and that matters to young stock traders,” said Shin Jin-Ho, co-chief executive at Midas International Asset Management Ltd. Results at Nvidia showed chip demand from AI-related businesses is real, he said, adding that “there are expectations that Korean chipmakers and other Korean firms in the supply chain would benefit significantly.”

--With assistance from Winnie Hsu, Shery Ahn, Paul Allen and Jiyeun Lee.

©2023 Bloomberg L.P.