If you're looking to create enduring wealth, the stock market is a great place to focus your attention. Businesses can grow their earnings power for decades, and some of the best companies have been rewarding shareholders with positive returns for over a century. Consider a company like Procter & Gamble, which has been paying out a dividend since the 90s -- the 1890s, that is.

Yet it's a challenge to identify stocks that can maintain their strong market positions for many decades, and there's always the risk of a major industry or technology shift impairing a previously successful business. That's why it pays to construct a portfolio of several world-class businesses. That way you aren't too dependent on any single company.

With that in mind, let's look at a few stocks that, from today's vantage point, seem poised to produce wealth over the long term.

1. Walmart

Walmart (WMT -1.22%) has been creating millionaires (beyond just the Walton family) for many generations. But there's plenty of room for this retailing giant to extend that momentum. Just take a look at the latest financial results that show how the company is winning with its core shoppers while extending into new markets and demographics.

Customer traffic was up 4% year over year this past quarter even as average spending rose 1%. The e-commerce segment jumped 22%. That division is already worth over $100 billion in annual sales and is bringing more high-income shoppers into the Walmart brand. You can bet management will lean heavily on growth there to keep pushing earnings higher in the coming years. Walmart is also investing aggressively in digital advertising, which has been a big source of income for rival Amazon.

Those growth initiatives help explain why Walmart pays a modest dividend yield of below 1% as of mid-November. Yet investors who hold this stock for decades should benefit from the company's aggressive spending in those attractive categories.

2. McCormick

McCormick (MKC -1.00%) hasn't had the best post-pandemic period, yet that's no reason to avoid the stock for this consumer foods producer. It dominates several attractive categories in the spice, flavorings, and sauces niches with global brands like Cholula, Old Bay, and French's. That premium market position has helped it protect profit margins despite having to pass along higher prices to consumers over the past two years and dampening demand in the process.

PEP Operating Margin (TTM) Chart

PEP Operating Margin (TTM) data by YCharts

Those price hikes have slowed to a crawl along with McCormick's decelerating costs in recent quarters. In Q3, the company returned to global volume growth as average selling prices declined slightly. "We expect this momentum to continue into the fourth quarter," CEO Brendan Foley said in an early October press release.

Sure, the 3% sales uptick that most Wall Street analysts expect in 2025 doesn't sound exciting. You could find faster organic growth from rivals like PepsiCo, which also happens to pay a higher dividend yield today.

McCormick's more focused portfolio, though, should pave the way for many more years of market share growth and improving profitability. That's a recipe for market-beating returns from here for a stock that's trailed the market through the 2024 rally.

If you're concerned about the timing of McCormick's rebound, you might want to watch the next few quarterly reports for concrete signs that the business is again ready to grow both sales volumes and average prices. Yet patient investors focused on the long term should consider adding the food specialist to their portfolios while there's still some uncertainty keeping its valuation relatively low.