The PHLX Semiconductor Sector index has lost 29% of its value in 2022 thanks to a slowdown in chip demand in two key sectors, smartphones and personal computers (PCs). But other areas such as data centers, artificial intelligence, the Internet of Things, and automotive have remained healthy, which probably explains why semiconductor stocks are on track to end the year on a high.

A closer look at the PHLX Semiconductor Sector index tells us that chipmakers are making a terrific recovery. More specifically, the index has gained nearly 30% in the past couple of months. This recovery has rubbed off positively on the index's constituents as well. Shares of ASML Holding (ASML -7.09%) and Taiwan Semiconductor Manufacturing (TSM -0.55%) -- popularly known as TSMC -- have shot up 62% and 25%, respectively, in the past two months.

The latest developments suggest that these semiconductor bellwethers could sustain their momentum on the stock market in 2023 and beyond. Let's see why that may be the case.

TSMC will spend $40 billion to make advanced chips in the U.S.

On Dec. 6, 2022, TSMC announced that it will build a second fabrication plant in Arizona. This second fab is expected to go online in 2026, and will make chips based on the 3-nanometer (nm) process node. The Taiwan-based foundry giant started the construction of its first Arizona fab in June last year. Being built with an investment of $12 billion, TSMC's first Arizona fab is expected to go online in 2024 and manufacture 5nm chips.

TSMC points out that the addition of the second plant will take its total investment in Arizona to $40 billion for the two fabs. It is not surprising to see that TSMC has more than tripled its investment in the Arizona fabrication plants. The company estimates that it will generate $10 billion in annual revenue from both plants when they go online.

TSMC is on track to generate nearly $75 billion in revenue this year, so the addition of the Arizona facilities will give its top line a nice boost. More importantly, the stronger production capacity of 5nm and 3nm chips should set TSMC up for solid long-term growth, as demand for these advanced process nodes is exploding.

In the third quarter of 2022, chips made using the 5nm process accounted for 28% of TSMC's revenue, up from 18% of the top line in the prior-year period. Healthy demand for 5nm chips played a key role in helping TSMC increase its revenue by 36% over the prior-year period to $20.2 billion in Q3.

It is worth noting that 5nm chips are in huge demand thanks to their usage in graphics cards, server processors, and smartphones. AMD's latest Epyc server processors, for instance, are based on a 5nm process node. Apple's latest iPhone is also powered by a 5nm TSMC-manufactured processor, while Nvidia reportedly paid $10 billion to TSMC earlier this year to tie up the supply of 5nm chips.

It is easy to understand why major semiconductor players are lining up for chips made using a 5nm process. Chips manufactured using a smaller, advanced process node are capable of packing more computing power along with higher power efficiency. As a result, several chipmakers are lining up to buy these chips from TSMC.

What's more, Apple is going to use 3nm processors from TSMC in iPhones and MacBooks from next year. Also, Intel is reportedly in the race to purchase 3nm chips from TSMC as well. As such, it is not surprising to see that TSMC is busy ramping up its 3nm manufacturing capacity with its latest move.

TSMC's investments in the U.S. should help the company cater to the growing need for smaller chips in the future, and eventually lead to robust growth in revenue and earnings. Analysts expect TSMC to deliver 21% annual earnings growth for the next five years, and its latest moves to increase capacity should help it live up to Wall Street's expectations in the future.

ASML is going to be another beneficiary

Dutch semiconductor equipment manufacturer ASML could be one of the biggest beneficiaries of TSMC's $40 billion splurge in the U.S. That's because ASML is the only manufacturer of extreme ultraviolet (EUV) photolithography machines that can make 5nm and 3nm chips. The company's monopolistic position in this market has helped it record terrific revenue and earnings growth in recent years as the demand for smaller process nodes increased.

ASML Revenue (TTM) Chart

ASML Revenue (TTM) data by YCharts

Now ASML's EUV lithography machines will allow its customers to get into the volume production of 3nm chips. As such, don't be surprised to see ASML's order backlog jump higher. The company received 8.9 billion euros worth of bookings in the third quarter of 2022, which easily outpaced its actual revenue of 5.8 billion euros.

Its total backlog stood at a whopping 38 billion euros at the end of the previous quarter. ASML management pointed out on the earnings call that "85 percent of this backlog is for EUV and immersion which is used for advanced nodes and related wafer capacity expansions." And now that TSMC has decided to ramp up its capital spending on making a 3nm fab, the demand for ASML's machines should increase. That's because TSMC is an ASML customer and has already placed orders for its advanced chipmaking tools.

ASML recently projected healthy long-term growth, and TSMC may have just accelerated it with its latest investment. So it wouldn't be surprising to see ASML live up to Wall Street's expectations and clock 30% annual earnings growth for the next five years, which makes it a top semiconductor stock to buy and hold for the long run.