Since stocks began trading on the Nasdaq roughly 50 years ago, the index has only produced negative annual returns 14 times. Over the last 20 years, the index has dropped by at least 30% on three occasions: 2002, 2008, and 2022.

Interestingly, following the precipitous declines of 2002 and 2008, the Nasdaq rallied for consecutive years thereafter. Between 2003 and 2007, the Nasdaq returned an average of 16% per year. And in 2009 and 2010, the index produced average returns of 30%.

After its painful performance in 2022, the Nasdaq rebounded sharply in 2023, returning 43%. It's safe to say that the euphoria surrounding artificial intelligence (AI) largely influenced the upswing in tech stocks.

But 2024 is off to a red-hot start, and further gains could be in store for investors. While each of the "Magnificent Seven" stocks below experienced AI-driven momentum last year, I think all of them still look enticing at the moment.

1. Amazon

Amazon (AMZN 3.43%) is best known for its e-commerce and cloud computing operations. The last few years have been brutal for Amazon. Unusually high inflation coupled with the rising interest rates that reined in that inflation have squeezed Amazon's core businesses. Consumers have scaled back their discretionary spending, putting a strain on Amazon's e-commerce efforts. In addition, as companies tightened their budgets, its software businesses witnessed a pronounced growth deceleration. This dynamic can be seen in the ebbs and flows of Amazon's revenue and free cash flow generation below.

AMZN Revenue (Quarterly) Chart

AMZN Revenue (Quarterly) data by YCharts.

But throughout 2023, Amazon made a series of savvy moves that could help reignite its growth. Among them, the company invested billions into OpenAI competitor Anthropic. As part of the deal, Anthropic will be training future generative AI models on Amazon Web Services (AWS).

Investors should not overlook the impact AI can have on Amazon. The technology should not only help fuel some renewed interest in AWS, but also integrate into Amazon's e-commerce, streaming, logistics, and advertising businesses.

Amazon's current price-to-sales (P/S) ratio of 3.1 looks like a bargain compared to its historical levels. Now could be a great opportunity to scoop up shares of this under-the-radar AI player.

2. Microsoft

Microsoft (MSFT 1.82%) kicked off the AI revolution with its investment in OpenAI -- the developer of ChatGPT. Since pouring billions into the start-up, Microsoft has swiftly integrated ChatGPT across the Windows operating system.

Similar to Amazon, Microsoft's Azure cloud platform carries some of the most lucrative growth prospects for the company as it relates to AI. The one concern I have about Microsoft is its valuation.

MSFT PE Ratio (Forward) Chart

MSFT PE Ratio (Forward) data by YCharts.

At a forward price-to-earnings (P/E) multiple of 35.5, Microsoft trades at a premium compared to most of its Magnificent Seven peers. While it's reasonable to believe that the expected impacts of AI are baked into Microsoft's price, perhaps more than some of its peers, I don't think the stock is egregiously overvalued.

Clearly, investors are placing a premium on the biggest names in AI -- and Microsoft is no exception. Given that AI is in its early innings, I see Microsoft as well-positioned to dominate in the long run. Despite its premium valuation, now could still be a good time to use dollar-cost averaging to add some shares to your portfolio.

3. Alphabet

Alphabet (GOOG 9.96%) (GOOGL 10.22%) owns two of the world's most visited websites: Google and YouTube. Given Alphabet's commanding surface area on the Internet, it's not a surprise to learn that advertisers are keen to be seen on its platforms.

But although advertising has long been Alphabet's primary revenue and profit machine, the company is in the midst of an identity crisis. Social media platforms including TikTok, Instagram, and Facebook have become increasingly popular over the last few years -- especially among highly coveted demographics, including Gen Z and millennials.

As such, growth in Alphabet's advertising business has started to plateau, investor enthusiasm is starting to wane, and Alphabet stock is taking a hit. On a price-to-sales basis, Alphabet is the second cheapest stock in the Magnificent Seven.

MSFT PS Ratio Chart

MSFT PS Ratio data by YCharts.

Nevertheless, I still see many reasons to own Alphabet stock. First, the company is quickly gaining momentum in the cloud computing landscape. What's even better is that its cloud segment is generating positive operating income on a consistent basis, mitigating some of the deceleration in the core advertising business.

Moreover, the cloud is really where Alphabet is focusing its artificial intelligence efforts. So, even though the advertising business is currently facing some challenges, investors can actually buy Alphabet's AI business at a pretty steep discount.

4. Meta Platforms

Meta Platforms (META 0.43%) owns social media apps Instagram, Facebook, and WhatsApp. Additionally, the company has a budding metaverse operation via its virtual reality (VR) and augmented reality (AR) hardware products.

The last couple of years have been tough for Meta, however. The company pivoted to an all-in approach to the metaverse a couple of years ago. While this was initially met with praise, investors quickly soured on the company after a series of poor earnings reports that featured decelerating growth in the core advertising business and mounting losses.

Meta spent much of 2023 turning things around and shifting its focus back to its bread-and-butter businesses.

META Revenue (Quarterly) Chart

META Revenue (Quarterly) data by YCharts.

With sales and free cash flow on the rise, Meta appears to have climbed its way out of a hole. What's even better is that in the wake of this newfound growth, Meta has found ample ways to reward shareholders. Following its fourth-quarter earnings report earlier this year, Meta announced a $50 billion share repurchase and the initiation of a quarterly dividend.

Given that artificial intelligence can significantly impact both Meta's advertising and metaverse businesses, the long-term ride could just be getting started for the social media conglomerate.

5. Nvidia

Last on the list is Nvidia (NVDA 6.18%), a developer of high-performance graphics processing units (GPUs). Make no mistake about it -- the AI narrative largely hinges on Nvidia. The company's A100 and H100 GPUs are in high demand as generative AI takes the world by storm.

The most lucrative thing about Nvidia is that AI touches nearly every aspect of its business -- from data centers to software development and more. What I find most attractive about Nvidia is that it's aggressively deploying its ever-growing profits. The company recently invested in two budding areas of AI: voice-recognition software and robotics.

NVDA Revenue Estimates for Current Fiscal Year Chart
NVDA Revenue Estimates for Current Fiscal Year data by YCharts.

While the company's market cap has grown by $1 trillion in less than a year, I think the momentum can easily continue. Considering that its outlook is robust for the next several years, Nvidia's valuation seems warranted. Now could be a great time to buy some shares to hold for the long term.