Over the long term, there are fewer tools that investors have that can build wealth quite like the stock market. The S&P 500, for example, has done a wonderful job of bringing investors financial independence. But some businesses have performed even better than the broader market.

Take Procter & Gamble (PG -1.34%). In the past 40 years, this consumer staples stock has produced a total return, including dividends, of 14,810%. That means a $10,000 investment would've turned into $1.5 million today.

Let's take a closer look at this company to see if it may be a good addition to your portfolio.

A household staple

Since being founded in 1837, Procter & Gamble has had a long and storied history of dominating the consumer staples sector. It went from selling soap and candles to now offering a wide range of merchandise. Investors are familiar with its products, which range from Head & Shoulders shampoo and Crest toothpaste to Vicks medicine and Bounty paper towels. The company has more than 20 different products that alone generate at least $1 billion in annual revenue.

What's made this business a winner for investors is the simple fact that it experiences durable demand. Procter & Gamble doesn't operate in the tech sector, which registers rapid change. It sells boring things people need in their day-to-day lives. This also leads to repeat purchase behavior and customer loyalty.

An important attribute is that Procter & Gamble has proven pricing power. Warren Buffett argues that this is one of the top factors in assessing whether a business is good or not. Again, because the company sells essential products that consumers can't live without, Procter & Gamble is able to charge higher prices over time.

When you combine durable demand with pricing power, you get solid fundamental performance. Indeed, Procter & Gamble's revenue and net income have steadily climbed over the years. The growth hasn't been spectacular, but it has been consistent and long-running.

The gains have continued even more recently. Between fiscal 2018 and fiscal 2023 (ended June 2023), the business reported annualized revenue growth of 4.2%. Diluted earnings per share rose at a compound annual rate of 9.8%. And during the latest fiscal quarter (ended March 31), Procter and Gamble generated $3.3 billion of free cash flow, which helps fuel its favorable capital allocation policy.

Is it too late to buy the stock?

This business has undoubtedly rewarded its shareholders over the past few decades. But if we look out over the next five or 10 years, I believe the stock won't outperform the S&P 500.

One reason is because of the premium valuation. Procter & Gamble shares trade at a price-to-earnings ratio of 26.7. That's not only more expensive than the broader index, but it's a higher multiple than a company like Alphabet, which is arguably one of the highest-quality enterprises the world has ever seen with strong growth prospects.

Therefore, I think it's safe to say that Procter & Gamble is overvalued today. That's even more true when you consider that its sales are only projected to rise at a 3.4% yearly pace over the next three fiscal years, according to Wall Street consensus analyst estimates.

However, income-seeking investors should consider buying the stock. While the current dividend yield of 2.46% isn't anything to write home about, it's worth noting that Procter & Gamble has raised its quarterly payout in 68 straight years. Good luck finding a business with that type of track record.