The stock market tends to reward investors who buy and hold for the long run. It's worthwhile to seek out companies that are likely to perform well for decades to allow time for compounding to take effect. A good place to start looking would be businesses that people have come to trust for reliability and good service. Customer loyalty lasts longer than a hot product.

Amazon (NASDAQ:AMZN), Home Depot (NYSE:HD), and Starbucks (NASDAQ:SBUX) are three companies building strong relationships with customers -- and they look like attractive stocks to hold for the next few decades.

A man counting hundred dollar bills.

Image source: Getty Images.

Amazon 

Prime members are fueling rapid revenue growth for Amazon. Their presence helps Amazon attract third-party sellers to its site. Those merchants pay Amazon a commission on each sale.

People have relied more heavily on e-commerce during the pandemic, increasing the value of a Prime membership. The company boasted 150 million Prime members before the pandemic's onset, and it's likely much higher than that now. Subscription revenue, including fees associated with Amazon Prime memberships, increased by 32.6% in the most recent quarter and 29.8% in the first nine months of 2020. Prime members are likely to be more loyal to Amazon, so increasing the membership base will support long-term sales growth.

Amazon also operates a lucrative cloud computing business. In fact, in the first nine months of 2020, Amazon Web Services generated 62% of Amazon's operating income despite accounting for only 13% of its sales. What's more, due to technology improvements, Amazon increased the estimate of its servers' useful life from three years to four years, effective Jan. 1, 2020. By extending the useful lives of its servers, Amazon can get more bang for its buck when making capital investments in the segment.

Two men working on a home-improvement project.

Image source: Getty Images.

Home Depot 

As people are spending more time at home because of the pandemic, the home is taking on more importance. For many of us, it's a classroom for our kids, a workplace for parents, a gym, an entertainment venue...you get the idea. Many people are making adjustments to their living spaces. In some cases, those changes will necessitate future maintenance. For example, if you recently added a garden to your home, you may need to buy flowers on a seasonal basis. While you're visiting the store, you may add discretionary items to your cart.

That's great news for Home Depot. The home improvement retailer's sales rose 18% year over year in the first nine months of 2020. Home Depot probably can't sustain such double-digit growth for very long, but its future prospects are still bright. Over the last decade, it has grown revenue at a compounded annual rate of 5.2%. Investors can expect Home Depot to grow at a similar rate over the long term.

Home Depot is the home-improvement industry leader, positioning it to benefit from the extra attention people are giving to their homes. Home Depot stock sells at a premium compared to rival Lowe's, but for good reason. Over the last five years, Home Depot has maintained an operating profit margin of over 12.5%, while Lowe's has averaged less than 10% on the same metric.

Moreover, in another side effect of the coronavirus pandemic, people are increasingly fleeing rentals in urban areas to purchase homes in the suburbs. The shift has raised the homeownership rate in the U.S. to 67.2%: up from 64.9% at the end of 2019 and near the record of 69.4% set back in 2004. Homeowners tend to spend more maintaining their homes than renters. Since owning a home is a long-term commitment for most people, this could boost spending at Home Depot long after the pandemic diminishes.

A cup of iced coffee.

Image source: Getty Images.

Starbucks

Starbucks has made itself synonymous with good coffee. As evidence of its popularity among coffee enthusiasts, it has 19.3 million active Starbucks Rewards members in the U.S. Moreover, last September, it stopped requiring customers to use a preloaded Starbucks gift card to earn rewards. That change will likely add many more members, including myself, who were not a fan of the prior policy.

After a challenging year, Starbucks is optimistic it can bounce back with robust revenue growth in fiscal 2021. Admittedly, the timing of its recovery will depend on the impact of the coronavirus pandemic lessening. That being said, it has a product that many millions of people love -- so much so that they are willing to wait in long lines and pay premium prices.

The hot drinks market is expected to grow at a compounded annual rate of 8.3% over the next five years. As one of the industry leaders, Starbucks will benefit from that growth. It already has over 32,000 locations worldwide and aims to grow its store base 6% to 7% annually on average.

Starbucks, Home Depot, and Amazon have done an excellent job of serving their customers, gaining their trust, and establishing themselves as leaders in their respective categories. That has taken years of overcoming challenges and making the right decisions more often than not. Investors looking for stocks that they can hold for decades can feel good about adding these three to their portfolios. 

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.