It hasn't been easy to be a stock investor in recent years, with more market volatility than usual.

The COVID-19 pandemic saw many stocks skyrocket in 2021 as homebound consumers invested in home offices and entertainment products. However, an economic downturn in 2022 brought the market crashing back down and led many companies' shares to lose what they had gained the year before.

Then, in 2023, the market once again swung in the opposite direction, with the Nasdaq Composite climbing 43%. Excitement over tech and artificial intelligence (AI) prompted an impressive recovery. And the same index is up about 8% in 2024, seemingly breaking the yo-yo-like pattern that has occurred in recent years.

However, recent volatility highlights the importance of investing in stocks with a long-term mindset. Those who sold in 2022 will not have profited from the swift rise many stocks enjoyed in 2023 and continue to see this year.

As a result, now is an excellent time to fortify your portfolio by investing in companies likely to deliver consistent gains long into the future. So, here are two hypergrowth stocks to buy in 2024 and beyond.

1. Nvidia

Tech stocks have surged over the last year thanks to a boom in AI. According to Grand View Research, the industry hit close to $200 billion in 2023 and is projected to expand at a compound annual growth rate of 37% until at least 2030. This trajectory would see the AI market reach a valuation nearing $2 trillion.

Meanwhile, Nvidia (NVDA 6.18%) has cornered the market on AI chips. Last year, the tech giant achieved an estimated 90% market share in AI graphics processing units (GPUs), the chips necessary to train and run AI models. Nvidia's success in the industry has seen its stock increase 294% over the last year alongside soaring earnings.

In the last 12 months, Nvidia's quarterly revenue has risen 207%, while operating income has skyrocketed 536%. Additionally, Nvidia's free cash flow is up 430% to more than $27 billion. For reference, rival chipmakers like Advanced Micro Devices and Intel posted free cash flow of $1 billion and negative $14 billion last year.

So, despite new GPU releases from both chipmakers, Nvidia's head start in AI potentially pushed it further ahead with greater cash reserves to continue investing in its technology and retain its market supremacy.

NVDA PE Ratio Chart

Data by YCharts

Moreover, this chart shows Nvidia's stock is potentially trading at its best value in months, with its price-to-earnings and price-to-free-cash-flow ratios declining by double digits since last July. These are helpful metrics in determining a stock's value, with the lower figure representing the better the value.

Alongside a lucrative role in AI, Nvidia is a hypergrowth stock worth considering in 2024 and beyond.

2. Amazon

Amazon (AMZN 3.43%) is a tech behemoth with a market cap of $1.8 billion, making it the world's fifth most valuable company. Since its founding almost 30 years ago, the retail giant has expanded to multiple industries, from becoming a titan of e-commerce to leading the cloud market, developing space satellites, and venturing into grocery, gaming, consumer tech, and more.

The company was one of the hardest hit in 2022, as spikes in inflation curbed consumer spending and caused its stock to plunge 50% during the challenging year. However, Amazon pulled off an impressive turnaround last year, which has proven the value of its stock as a long-term hold.

In fiscal 2023, Amazon's revenue rose 12% year over year, with operating income more than tripling to $37 billion. Various cost-cutting moves brought profitability back to its retail segments. Meanwhile, the company's dominating position in the cloud market with Amazon Web Services granted it a promising role in AI. As the world's biggest cloud service, AWS has the potential to leverage its massive cloud data centers and steer the generative AI market.

AMZN EPS Estimates for 2 Fiscal Years Ahead Chart

Data by YCharts

This chart indicates that Amazon's earnings could achieve nearly $7 per share by fiscal 2026. When multiplying that by Amazon's forward P/E of 42, you get a stock price of $294.

From its current position, this would see Amazon's stock rise 66% over the next two fiscal years. Alongside dominating positions in e-commerce and cloud computing, Amazon's stock is worth buying right now.