After enduring one of its worst performances since 2008, the Nasdaq Composite has turned things around, gaining 50% since the beginning of last year. After such a sharp move higher, some investors wonder if much upside remains.

Yet a review of the data suggests the current market rally still has room to run. Since the storied index began trading back in 1972, every year after a market recovery begins, the tech-heavy index has risen 19%, on average. The ongoing battle with inflation is a wild card that could still throw a wrench in the works. That said, history suggests that 2024 should be a profitable year for investors.

It's generally agreed that recent advances in artificial intelligence (AI) have helped fuel the market's ascent and will likely drive additional gains in 2024. While estimates vary, generative AI is expected to add between $2.6 trillion and $4.4 trillion annually to the global economy in the coming years, according to data compiled by McKinsey Global Institute. Companies at the cutting edge of AI will enjoy a veritable windfall.

Here are my top five AI stocks to buy before the Nasdaq climbs to new heights.

Wall Street traders looking at graphs and charts cheeing because the stock market went up.

Image source: Getty Images.

1. Nvidia

No discussion regarding the potential for AI would be complete without a nod to Nvidia (NVDA -3.89%). The maker of graphics processing units (GPUs) is the gold standard for several AI use cases, including machine learning, cloud computing, and data centers -- and its processors have quickly become the go-to for generative AI. Demand has far exceeded supply, with the resulting chip shortage expected to persist until 2025. Competition is fierce, but Nvidia's decades of experience and significant spending on research and development have kept its rivals at bay.

For its fiscal 2024 (ended Jan. 28), Nvidia's revenue and earnings per share (EPS) grew 126% and 586%, respectively. While no one expects its triple-digit gains to continue indefinitely, demand is expected to remain strong. Furthermore, while 34 times forward earnings might seem pricey, its growth illustrates why Nvida is deserving of a premium.

2. Microsoft

Microsoft (MSFT 1.44%) was another company that was quick to capitalize on the generative AI opportunity. After years of toiling behind the scenes, it took a $13 billion stake in ChatGPT creator OpenAI and rolled out its Copilot suite of AI assistants. Copilot is deeply integrated into Microsoft's core offerings, streamlining time-consuming tasks and making workers more productive. A survey of early users found that once they tried Copilot, 77% said they "didn't want to give it up."

New versions are still being introduced. While estimates vary, some analysts believe Copilot could generate as much as $100 billion in incremental revenue annually, which will be a boon to the company. Furthermore, Microsoft's Azure Cloud is gaining market share and attributing its accelerating growth to AI. At 35 times forward earnings, Microsoft is selling for a premium compared to a multiple of 27 for the S&P 500, but that's pretty reasonable considering Microsoft's potential.

3. Palantir Technologies

Palantir Technologies (PLTR 0.68%) has been laboring in the field for more than 20 years, supplying AI-fueled data analytics to governments and enterprises alike. When AI went viral last year, the company met the challenge head-on, introducing its Artificial Intelligence Platform (AIP), which layers generative AI onto its already robust offerings.

Palantir offers "boot camps" to identify mission-critical issues it can solve with AIP, and demand has been off the charts. The company planned to host 500 sessions in one year and blew past the goal in just four months. As a result, Palantir's U.S. commercial revenue jumped 70% year over year and 12% sequentially, making it the company's fastest-growing business, and it's only just getting started.

Palantir's forward price/earnings-to-growth (PEG) ratio is less than 1, the standard for an undervalued stock.

4. Super Micro Computer

It isn't just chips and software that are fueling the AI revolution. Most AI processing happens on cloud or data center servers, and that's where Super Micro Computer (SMCI -14.03%), also known as Supermicro, comes in. The company works closely with Nvidia, Advanced Micro Devices, Intel, and others to develop cutting-edge servers that can withstand the rigors of AI processing. These close ties ensure that Supermicro servers are optimized to be AI workhorses while also focusing on energy efficiency.

Demand is strong and the company is taking market share from its rivals. In its fiscal 2024 second quarter (ended Dec. 31), revenue grew 103% year over year while its adjusted EPS jumped 71%. Yet despite its impressive growth, Supermicro is selling for less than 3 times forward sales, a bargain when considered in the light of its opportunity.

5. Alphabet

Alphabet (GOOGL 0.66%) (GOOG 0.56%) has a long history of deploying AI to boost its search and digital advertising businesses. The company quickly deployed generative AI functionality into its core Google and Android products. Furthermore, the company is well positioned to offer generative AI models to its cloud customers via Google Cloud, the world's third-largest cloud infrastructure provider.

One of its biggest opportunities is Gemini, which the company says is its "largest and most capable AI model." Furthermore, Google's Vertex AI platform provides 130 foundational models that help users build and deploy generative AI apps without having to reinvent the wheel.

Recent advancements in AI will likely help fuel the recovery in Google's digital advertising business, and at less than 27 times earnings, Alphabet stock is a steal.