Financial independence -- particularly after retirement -- is one of the reasons many people choose to invest in stocks. But to truly be financially secure in retirement, it helps to start investing as early as possible. For young investors, putting money in quality stocks and letting the magic of compounding do its thing is one of the secrets to building financial wealth and securing a relatively comfortable retirement. 

If you are still under 30, Intuitive Surgical (ISRG -2.79%) and Amazon (AMZN 0.88%) are two top stocks that will make your money work for you over the next few decades. These companies have some things in common that make them excellent picks: They both have a long and successful track record, a strong competitive advantage, and a bright future in at least one industry that is still ripe for growth. 

Dollar bills raining on a woman with her hands in the air

Image source: Getty Images.

1. Intuitive Surgical: A leader in robotic-assisted surgery

Intuitive Surgical is best known for its da Vinci System, a robotic-assisted surgery device that was cleared by the U.S. Food and Drug Administration in 2000. Since then, the healthcare company's revenue and profits have increased at a relatively steady pace, and its stock performance has crushed that of the broader market, as the graph below shows. 

Its signature da Vinci System helps doctors perform minimally invasive surgeries, which have several health advantages over other types of procedures, including less bleeding, shorter hospital stays, and faster recovery times, to name a few. Despite these perks, most surgeries conducted with these nifty devices still represent a tiny percentage of overall procedures performed worldwide.

In other words, although Intuitive Surgical had 5,865 of its devices installed worldwide during its third quarter than ended Sept. 30 (representing an 8% year-over-year increase), there is still a lot of room to grow in its own market. 

ISRG Chart

ISRG data by YCharts

And despite potential competition from Medtronic, Johnson & Johnson, and others, there are excellent reasons to think Intuitive Surgical can remain a leader. The healthcare company has already jumped over several barriers to entry into this market, including building a robotic-assisted surgery device and the accompanying instruments, acquiring clearance from regulatory authorities, marketing its product, and training healthcare professionals to use it.

Competitors will have to do the same if they hope to catch Intuitive Surgical, but the company has no plans to sit on its laurels in the meantime. This gives Intuitive Surgical a strong competitive advantage over its peers, and the company looks likely to continue outperforming the market for the foreseeable future. 

2. Amazon: E-commerce and so much more 

If there is such a thing, Amazon has definitely been a winner of the COVID-19 pandemic. Although the company's stock fell sharply along with the market in the early days of the outbreak, it has recovered nicely since, and it is up by roughly 73% year to date, compared to gains of 14% for the S&P 500 over the past 12 months or so. A greater reliance on e-commerce by the general public is partly behind Amazon's terrific performance this year.

Perhaps more importantly, the tech giant has consistently outperformed the broader market for more than 20 years. And what's more, Amazon may be just getting started. First, although e-commerce now seems ubiquitous, e-commerce sales accounted for just 14.3% of total sales during the third quarter of 2020, according to the U.S. Department of Commerce.

This sector has been growing at a steady pace in recent years, and it still has a lot of room to grow -- and Amazon is well-positioned to profit. The company benefits from at least two competitive advantages in this space, namely its brand name and the network effect, which refers to the increase in the value of a product or a service as more people use it.

Amazon's shopping platform offers several advantages to customers, including convenience, low prices, and fast shipping, which helps attract many consumers. Merchants looking to reach a wide customer base then turn to Amazon, and as the number of merchants on the platform grows, the number of customers grows, and so on. 

Second, Amazon is a leader in the cloud computing industry, thanks to Amazon Web Services (AWS). In fact, according to the research firm Canalys, AWS held a 31% market share during the second quarter of 2020, the largest share of any single company (Amazon's closest competitor held a 20% market share).

And given that this industry has been growing rapidly, and will likely continue on this trajectory, betting on Amazon to profit from this long-term trend is a pretty safe bet. With a leadership position in two industries, a hand in many other businesses (streaming videos and music, electronic devices such as tablets, and more), and a management team that continues to look for ways to broaden its moat, Amazon is a solid stock to buy for young investors thinking ahead toward retirement.