Stocks continued to gain on Wednesday morning, with the Nasdaq Composite (NASDAQINDEX:^IXIC) joining in on the fun. The Nasdaq had climbed half a percent as of 11:15 a.m. EDT today, bringing it once again to within about 1% of its record closing high from last week.

The Nasdaq is full of technology stocks, and many of them have put in outstanding performance over the past year. In particular, many investors are looking at the semiconductor industry as a key driver of growth in tech, especially given the current supply-and-demand issues that are leaving buyers scurrying to find much-needed semiconductor chips. That's a big part of why semiconductor companies are the hottest stocks in the Nasdaq on Wednesday, and they could remain in favor for quite awhile.

Person wearing safety glasses and mask holding a semiconductor in a gloved hand.

Image source: Getty Images.

Big gains for chip companies

Investors found strength in many different niches of the semiconductor space. Big companies like Nvidia (NASDAQ:NVDA), Advanced Micro Devices (NASDAQ:AMD), and Intel (NASDAQ:INTC) gained ground, rising 5%, 2%, and 1%, respectively. Texas Instruments (NASDAQ:TXN) was up more than 2% in advance of its release of earnings results later this afternoon. Broadcom (NASDAQ:AVGO) and Qualcomm (NASDAQ:QCOM) also picked up more than 1% on the day.

Some of the biggest gains were reserved for companies specializing in semiconductor equipment. Applied Materials (NASDAQ:AMAT), KLA (NASDAQ:KLAC), and ASML Holding (NASDAQ:ASML) all climbed 3%, while Lam Research (NASDAQ:LRCX) picked up 4%.

Solid earnings from ASML

Some of the enthusiasm for the industry came from ASML, which released its own second-quarter 2021 earnings this morning. It reported a 21% rise in total sales compared to the year-ago quarter, led by sizable gains in both sales of equipment systems and service revenue. Earnings jumped more than 40% year over year to 2.52 euros ($3) per share.

One sign of strong demand came from ASML's bookings numbers . Net bookings were more than double ASML's sales, allowing the company to build up a nice backlog of 17.5 billion euros ($20.6 billion) that should promote further growth for the rest of the year and beyond. Indeed, the semiconductor equipment maker said it sees sales rising more than 30% sequentially in the third quarter.

ASML also treated shareholders well, announcing a new stock repurchase program that could have the company spending up to 9 billion euros between now and the end of 2023. That's likely only to add to the huge gains in the stock recently.

Plenty of opportunity

The semiconductor industry is notoriously cyclical. When shortages of semiconductor chips occur, chipmakers dramatically boost their production capacity in order to meet short-term demand. Once the shortage eases, companies are left with much higher capacity without corresponding demand, which usually causes chip prices to plunge. In response, profits fall, and semiconductor companies have to retrench and curtail supply, setting the stage for the next set of cyclical chip shortages.

Over time, you can see the rises and falls in most semiconductor stocks that result from these cycles. But overall growth has generally made the ups more substantial than the downs. That's created great long-term opportunities for investors who are willing to handle the likelihood of significant share-price declines at some point in the future when current shortages go away.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.