While there is still a lot of uncertainty in the near term with respect to the markets, investors who have at least 10 years to invest have an enormous advantage at building wealth compared to traders on Wall Street. That advantage is time.

McDonald's (MCD -0.42%) and Starbucks (SBUX -1.02%) are two examples of how just regularly putting money into shares of the top consumer brands can go a long way toward growing your savings for retirement. These companies have a long record of delivering profitable growth to shareholders, which has driven returns that outperformed the S&P 500 index over the last decade.

Chart showing McDonald's and Starbucks' prices beating the S&P 500.

Data by YCharts

These world-class restaurant operators have been delivering consistent returns for decades, even through multiple bear markets. There are good reasons to expect these brands to reward investors for years to come.

1. McDonald's

McDonald's has thousands of restaurants spread across 100 countries. It might be difficult to imagine how a brand with such high penetration can keep expanding, as the company's revenue hasn't grown at all over the last decade. But over the last few years, McDonald's has started to reap the benefits of its Accelerating the Arches strategy, which includes opening more restaurants and improving profitability. 

McDonald's latest results show why it's a stock worth buying. It followed up exceptional growth last year by reporting double-digit growth in U.S. comparable sales in the first quarter. One area of strength has been digital sales. In the company's top six markets, digital orders now represent nearly 40% of systemwide sales and grew over 30% year over year.

Most importantly, McDonald's continues to tinker with its core menu, improving cooking procedures and the taste perception of its burgers and buns. The proof is in the numbers. In the recent earnings report, management reported an increase in guest count. 

The market has taken notice of the improved operating performance at the Golden Arches. The stock has climbed 80% over the last five years. Its growing digital business and improving margins have analysts forecasting growth in earnings per share of about 8.5% per year over the next five years. That amount of growth won't make you rich overnight, but along with the stock's above-average dividend yield of 2%, McDonald's should be a rewarding and safe investment to hold for many years.

2. Starbucks

Shares of Starbucks have performed similarly to McDonald's through the pandemic, up 85% over the last five years and not far off its all-time high right now. With high inflation over the last year, people have shifted their spending patterns from goods to services, and one of those essential services that people obviously can't live without is their morning coffee on the way to work.

The business has performed spectacularly over the last year, and it seems to be getting stronger. In the company's fiscal fourth-quarter earnings report in November, management noted that demand was accelerating. Growth continues to look strong, with global comp sales up 11% year over year last quarter. 

Like McDonald's, it's difficult to imagine how Starbucks can keep delivering such strong numbers with a store on every corner. But CEO Laxman Narasimhan still sees a lot of potential for the brand. "From my immersion observations, our leadership team now has a clear line of sight into our growth headroom, as well as our opportunities to enhance margins and modernize the business, brand, partner experience and culture of Starbucks." 

Starbucks' strong top-line growth suggest there is high demand from customers, yet its profit margin is lower than pre-pandemic levels when the company consistently reported a net profit margin above 12%. Analysts seem to agree that there is a lot of room to expand margins, and, therefore, grow earnings per share faster than revenue. The consensus analyst estimate currently has earnings growing at 18% per year over the next five years. 

With McDonald's and Starbucks, investors are getting two restaurant brands that are showing signs of being resilient in a recession and should deliver more returns for years to come.