Investors should endeavor to hold stocks for the long term, ideally for decades, so it's important to choose the right ones. Great businesses typically have large competitive advantages, strong leadership teams, and products that consumers don't want to live without. Buying shares of companies with these characteristics makes holding for decades much easier.

On that note, let's consider the following three stocks below. All are stalwarts that could help provide a strong foundation to almost any investment portfolio. Let's dig in to see why.

Apple

No stranger to anyone, Apple (AAPL -0.35%) is a mainstay of the American consumer experience. The popularity of its devices has helped make Apple one of the largest companies in the world, with a market cap of $2.6 trillion. 

Over the past year, Apple has seen its revenue growth decline due to consumers pulling back on discretionary spending. However, Apple's net income margin has remained relatively consistent, demonstrating Apple has many levers to pull to align spending with revenue.

Even as total revenue has weakened, Apple's services segment has continued to grow its revenue. The services segment includes high-margin subscription products like Apple Music and iCloud storage plans. The continued strength here shows the importance of this part of the business, which now represents 26% of overall revenue.

Apple also continues to generate free cash flow, including over $100 billion during the past year. Apple's cash generation has allowed it to buy back tons of its own stock. Over the last five years alone, the company has decreased its shares outstanding by 17%.

Amazon

During the pandemic, Amazon (AMZN 3.43%) saw record business as the world turned to e-commerce to buy almost everything. As a result, the company had to spend big to accommodate the demand. In one of the more amazing statistics that came out of this period, Amazon doubled its fulfillment network in approximately two years. 

The result of that spending was some pretty discouraging earnings for several quarters. In Q1 of 2022, Amazon posted a net loss of $3.8 billion and free cash flow of negative $18 billion. The good news is that in the quarters since that low point, both of these metrics have headed back in the right direction. In the most recently reported quarter, net income reached $9.9 billion, and the company generated $8.7 billion in free cash flow. That's a pretty impressive turnaround in only six quarters, and it demonstrates Amazon's business strength. 

It's also worth noting that Amazon's advertising business is rather quietly becoming a driver of revenue for the company. Advertising revenue increased by 26% year over year in Q3 of 2022 and was the fastest-growing part of the business for the quarter. 

Costco

For over a year now, there have been rumors and predictions of an impending recession. One smart move investors can make in anticipation is to buy stock in companies that have some resilience to economic downturns. One such company, in my opinion, is Costco Wholesale (COST 1.01%).

With its focus on lowering prices for consumers through offering bulk purchases, Costco is in a good position to remain successful even during a recession because that's when consumers become most cost-conscious. If there has been any pullback in consumer spending over the last year, Costco has not felt much of it.

When Costco reported its Q4 2023 results in late September, the financial picture looked good. Revenue increased by 9% year over year and same-store sales grew by 3.8%. Costco improved on the bottom line as well, with earnings per share increasing by 16%.

More recently, Costco released its September sales update, which covered a five-week period encompassing the month of September. The news here was good as well. Same-store sales growth accelerated to 4.8%. Of particular interest was e-commerce sales, which grew by 3.7% after declining 0.8% year over year in Q4 of 2023. 

The value proposition that Costco provides is clearly compelling for its customers. Because Costco sells essential items at attractive prices, we should expect to see retailer succeed even through the next recession. This makes the stock easy to hold over the long term.