The S&P 500 made an impressive recovery last year, rising 24% in 2023 after an economic downturn saw it plunge 19% the previous year. And the index has shown no signs of slowing in the new year.

The S&P 500 hit a new all-time high this month, closing at 4,840 on Jan. 19 and officially entering bull market territory. A bear market is typically defined as a 20% drop from recent highs, ending when stock prices reclaim that 20% and achieve a new high. A bull market could be an excellent time to expand your portfolio by prioritizing the stocks, fueling the bulk of its growth.

Over the last year, rising stock prices have been mainly attributed to a boom in artificial intelligence (AI). The launch of OpenAI's ChatGPT in November 2022 reinvigorated interest in the technology, with countless companies pivoting their businesses to the budding market. Excitement over AI will likely continue this year, indicating it's not too late to make a long-term investment in the sector.

So here are two hypergrowth AI stocks to buy in 2024 and beyond.

1. Nvidia

We're not even through January, and shares of Nvidia (NVDA 6.18%) are already up 24% year to date after soaring 239% in 2023. The company's business has exploded over the last 12 months, as its graphic processing units (GPUs) have become the go-to for AI developers everywhere.

GPUs are crucial to training and running AI models, leading demand for the chips to skyrocket last year. Meanwhile, Nvidia's over 80% market share in GPUs made it well-positioned to supply its hardware to most of the market. A spike in chip sales has seen Nvidia's quarterly revenue climb 200% over the last year, with operating income up 729%.

The chipmaker's meteoric rise has analysts questioning if Nvidia can keep up its current growth rate, with some speculating that overbought chip stocks could be in for a sell-off in 2024. However, that's why keeping a long-term perspective when investing is crucial. As Warren Buffett has often said, "If you aren't willing to own a stock for 10 years, don't even think about owning it for 10 minutes."

According to Grand View Research, the AI market was valued at nearly $200 billion last year and is projected to well exceed $1 trillion before the end of the decade. The sector's growth trajectory suggests chip demand will likely continue trending up for the foreseeable future. As a result, Nvidia could continue seeing major gains from its estimated 80% to 95% market share in AI GPUs for years.

NVDA EPS Estimates for Next Fiscal Year Chart
Data by YCharts.

EPS estimates align with Nvidia's potential. This chart shows its earnings could hit $24 by fiscal 2026. Multiplying that figure by the company's forward price-to-earnings ratio (P/E) of 50 yields a stock price of $1,200, projecting growth of 97% over the next two years.

As a result, it's worth buying Nvidia now and holding indefinitely. And if its stock does dip, it could be an excellent time to buy this hypergrowth stock on sale.

2. Alphabet

There are multiple ways to invest in AI, with semiconductor companies like Nvidia and hyperscalers some of the most attractive options. Hyperscalers like Alphabet's (GOOGL 10.22%) (GOOG 9.96%) Google Cloud, Amazon Web Services, and Microsoft's Azure are large cloud-based platforms that provide computing and storage at enterprise scale.

These firms are investing in the infrastructure for developing AI solutions, with the potential to leverage their massive cloud data centers to steer the market in their favor. As a result, Google Cloud's third-largest market share in cloud computing strengthens Alphabet's outlook in AI.

Additionally, the company unveiled its highly anticipated AI model, Gemini, last December. Alphabet expects the model to be competitive with OpenAI's GPT-4, and believes it could unlock countless growth opportunities in AI.

With Gemini, the tech giant could have the technology to create a search experience closer to ChatGPT, offer more effective and cost-efficient advertising, introduce new AI tools on Google Cloud, and better track viewing trends on YouTube. Each of these could significantly boost Alphabet's earnings in the coming years.

AI's potential to bolster the company's digital ad business is especially promising, as advertising makes up over 80% of Alphabet's revenue. Gemini and the billions of users that products like Google, YouTube, and Android attract could prove a lucrative combination.

Meanwhile, the company hit more than $77 billion in free cash flow last year, indicating it has the funds to continue investing heavily in AI and overcome potential headwinds.

AMZN PE Ratio (Forward) Chart
Data by YCharts.

Moreover, this chart shows Alphabet is currently one of the cheapest ways to invest in AI. The company's forward P/E and price-to-free cash flow ratios are significantly lower than those of its biggest cloud rivals, Microsoft and Amazon.Alphabet's lower figures for both valuation metrics suggest its stock offers more value than these tech firms.

The Google company might not be as far in its AI journey as Microsoft and Amazon, but its stock could be worth buying cheap now and holding over the next decade. Alongside significant cash reserves and advanced AI tech, Alphabet is an exciting investment option in 2024 to hold indefinitely.