Shares of Flex (FLEX -0.79%) closed up 11% on Thursday after the electronics manufacturing company announced better-than-expected quarterly earnings and a plan to spin off its remaining interest in solar tracker and software solutions company Nextracker (NXT 5.93%) to shareholders.

On Flex's strong earnings, plans to divest Nextracker

For its fiscal second quarter of 2024, ended Sept. 29, 2023, Flex's net sales declined 3.8% year over year to $7.47 billion, translating to non-GAAP (adjusted) earnings of $0.68 per share (up from $0.63 per share in the year-ago period). Analysts, on average, were expecting significantly lower earnings of $0.58 per share on slightly higher revenue of $7.51 billion.

Flex CEO Revathi Advaithi praised management's focus on adjusting its product portfolio and expanding margins, adding that the company continues to make "solid progress" on its financial framework. 

In conjunction with its earnings release, Flex also announced a plan to spin off all of its remaining 51.47% interest in Nextracker to Flex shareholders on a tax-free pro-rata basis.

What's next for Flex shareholders?

The spinoff of Nextracker is still subject to the approval of Flex shareholders. But assuming all goes as planned, it should be completed in Flex's fiscal fourth quarter ending March 31, 2024. At that time, Flex shareholders are expected to receive roughly 0.17 shares of Nextracker class A common stock for each ordinary Flex share held. Cash payments will be made in lieu of any fractional shares of Nextracker stock.

In the meantime, including its interest in Nextracker Flex expects full fiscal-year revenue of $28.1 billion to $28.8 billion, with adjusted earnings per share of $2.49 to $2.66. Most analysts were modeling higher revenue of $31 billion, but with lower earnings of $2.45 per share.

Finally, in the interest of transparency, Flex expects full fiscal-year revenue excluding its interest in Nextracker to be in the range of $25.9 billion to $26.5 billion, with adjusted earnings per share of $2.05 to $2.18.

All told, I think investors are rightly excited by the combination of Flex's improving margins and their impending windfall given the spinoff of Nextracker, which will simultaneously allow Flex to refocus on its core business. The stock is understandably rallying in response today.