When choosing stocks to buy and hold for the long term, investors can stack the odds in their favor by looking for companies that provide essential services and generate plenty of free cash flow. It also helps to invest in growing industries.

For example, e-commerce and digital business services have only grown in relevance since the pandemic started and will continue to grow over time. Two tech stocks that are well-positioned to deliver satisfactory returns related to these two industries are Amazon (AMZN -2.56%) and Microsoft (MSFT -1.27%). Let's find out a bit more about these two buy-and-hold stocks.

A road in the shape of a dollar sign going through a forest.

Image source: Getty Images.

1. Amazon

U.S. e-commerce sales should increase 17.9% to $933 billion in 2021, according to eMarketer, and there's no company better positioned than Amazon to take advantage of that growth. Over the last four quarters, Amazon's North American sales came to $266 billion. That figure has more than doubled over the last three years. 

E-commerce is estimated to surpass 20% of total retail sales in the U.S. by 2024, which might as well be a forecast for Amazon's growth too. It has more than 200 million Prime members -- 50 million of which were added in the last 18 months. Prime provides a sticky ecosystem of services that incentivize customers to make Amazon their one-stop shop for just about anything.

Amazon has other profitable divisions that should grow the value of the business. Amazon Web Services (AWS) is the largest cloud service provider, with net sales up 37% year over year in Q2. AWS generated $4.2 billion of operating profit on $14.8 billion of net sales in the second quarter. 

Advertising should also be a growing source of profit for the e-commerce giant. The "other" sales category, which primarily includes advertising services, accelerated for the fourth straight quarter, reaching $28 billion in trailing-12-month sales.

Analysts expect Amazon to nearly double its profits over the next two years, as cloud and advertising services start to make up a larger piece of Amazon's business. Now is a great time to consider starting a position in this top tech stock.

2. Microsoft

The software giant has made early investors massive returns, but Microsoft continues to pump out plenty of growth to fuel those returns. In fiscal 2021 (which ended in June), revenue and adjusted earnings per share increased by 18% and 38%, respectively, over the previous year.

Over 75% of Fortune 500 companies rely on Microsoft's cloud services. Overall, revenue from Microsoft's Azure cloud business grew 51% year over year in the last quarter. 

Azure is a distant second to Amazon Web Services in market share, but Microsoft is a very formidable competitor in the cloud market. There are an estimated 50 billion devices that will come online by 2030, and Microsoft is currently the only cloud provider that supports a wide range of needs for enterprise customers, including delivering powerful cloud capabilities close to the end-user, or what's known as edge computing. 

Microsoft should also see growing demand for its core software business. Office 365 reached a record number of users during fiscal 2020. Businesses have been accelerating their usage of digital services since the pandemic began, and Microsoft is benefiting enormously. It recently announced a price increase for Office 365 subscription plans, reflecting growing demand. 

With more than 1 billion active devices that use Windows 10, Microsoft's leadership in software translates to strong financials. Over the last four quarters, Microsoft generated $56 billion in free cash flow on top of $168 billion in revenue. It returned $39.9 billion to shareholders through share repurchases and dividends in fiscal 2021. 

Simply put, Microsoft and Amazon have tremendous competitive advantages and strong free cash flow generating ability, and each offers great return potential for long-term investors.