(Bloomberg) — Samsung Electronics Co. will produce AI semiconductors for Tesla Inc. in a new $16.5 billion pact that marks a win for its underperforming foundry division.

Most Read from Bloomberg

South Korea’s largest company announced on Monday that it secured the 22.8 trillion won chipmaking agreement, which will run through the end of 2033. The plan is for an upcoming plant in Taylor, Texas, to produce Tesla’s next-generation AI6 chip, Tesla chief Elon Musk said on X, confirming a Bloomberg News report.

Samsung’s Seoul-traded shares rose as much as 5%, to their highest since September. A company spokesperson declined to comment, citing confidentiality terms in its contract.

“The strategic importance of this is hard to overstate,” the Tesla chief executive officer and X owner wrote. Musk, 54, will walk the production line himself and has been authorized by Samsung to assist in optimizing production, he said.

The contract win comes as Samsung has been steadily losing ground in chip manufacturing. The company, which makes its own memory chips and also fabricates semiconductors on behalf of clients, has had difficulty bringing in enough orders to fully utilize its foundry capacity. It has postponed completion of construction and operational ramp-up of its new Texas fab to 2026.

“Their foundry business has been loss-making and struggling with under-utilization, so this will help a lot,” said Vey-Sern Ling, managing director at Union Bancaire Privee in Singapore. “Tesla’s business may also help them to attract other customers.”

That’s in contrast to leading chipmaker Taiwan Semiconductor Manufacturing Co., which still cannot meet all demand. TSMC held a dominant share of 67.6% of the global foundry market in the first quarter this year, according to Taipei-based TrendForce. Samsung’s share slipped to 7.7% from 8.1% in the previous quarter.

What Bloomberg Intelligence Says

Samsung Electronics’ new contract to supply semiconductors implies a recovery in its foundry business’ 2-nanometer generation chip production. The $16.5 billion contract spans 2025-33 and could boost Samsung’s foundry sales by 10% annually, we calculate.

— Masahiro Wakasugi and Takumi Okano

Click here for the full research

Samsung and TSMC are both on pace to deliver the next generation of semiconductor advancement — moving to 2-nanometer fabrication — and the new deal is seen as a signal of confidence for the company’s upcoming fabrication technology.