In 2022, the market had a terrible year, which was likely because of the aggressive rate hikes instituted by the Federal Reserve. But investor optimism has improved since then.

From the start of 2023 to May 23 this year, the S&P 500 has soared 38%. The ongoing artificial intelligence (AI) boom is propelling some businesses more than others, lifting this broad index to record highs.

Investors likely are thinking of ways to put money to work. Here's one unstoppable stock that can continue to outperform the S&P 500 over the next five years. It deserves a closer look as a possible portfolio addition.

Impressive performance

In the last five years, shares of Alphabet (GOOG 0.76%) (GOOGL 0.79%) have skyrocketed 206%, a gain that trounces the S&P 500. Had you invested $1,000 in this "Magnificent Seven" stock in May 2019, you'd be sitting on almost $3,100 today.

Even though Alphabet sports a market capitalization of $2.2 trillion today, a figure that rivals the gross domestic product of the vast majority of countries, it could still be a winner in the future. That's partly because shares aren't excessively expensive by today's standards, trading at a forward price-to-earnings ratio of 23.3.

For comparison's sake, the S&P 500 is trading at a forward multiple of 21.6. Alphabet's slight premium to the overall market seems justified and presents investors with a buying opportunity.

Growth potential

Between 2018 and 2023, Alphabet reported annualized revenue and diluted earnings-per-share (EPS) growth of 17.5% and 21.4%, respectively. This strong fundamental performance definitely helped drive up the stock price.

There are reasons to believe this momentum can continue for the foreseeable future. Digital advertising, which makes up 77% of the company's revenue stream, is set to be a $1.2 trillion global industry by 2030, almost triple today's size, according to Grand View Research. With top market share, Alphabet is in the best position to benefit compared to its peers.

Ad sales are boosted by YouTube, the most popular streaming platform in the world, which has 2.5 billion monthly active users. As these people continue spending more time watching content on the service, Alphabet is set to reap the benefits of greater digital-ad revenue.

An under-the-radar segment, Google Cloud, is becoming increasingly important. This division registered 26% sales growth in 2023, much faster than the company overall. After posting operating income of $1.7 billion last year, Google Cloud reported a 9.4% operating margin in Q1. Shareholders hope that profitability continues to improve as fixed costs are better leveraged.

Over the next three years, the Wall Street consensus analyst estimate calls for revenue and diluted EPS to rise at compound annual rates of 11.5% and 19.2%, respectively.

Tremendous profitability

There are very few businesses that are as financially sound as Alphabet. As of March 31, the company had $108 billion of cash, cash equivalents, and marketable securities on the balance sheet. This was a much larger sum than the total long-term debt burden of $13 billion. Investors don't need to worry about Alphabet running into financial troubles anytime soon, if ever.

Plus, Alphabet generated $16.8 billion of free cash flow in Q1, which represented 21% of its overall revenue during the period. This type of cash production is nothing unusual. And it places the business in an advantageous position to continue investing aggressively.

The company currently has a focus on expanding its technical infrastructure for AI-related initiatives to further advance its competitive position. It's hard to compete with this.

Alphabet has been a big winner in the past. In the years ahead, it's in a good position to continue beating the S&P 500.