Despite recent volatility, the S&P 500 climbed nearly 29% between June 2019 and June 2022, generating a return of 8.7% per year. But hedge fund managers Chris Hohn and David Tepper managed to beat the market during that period, achieving annualized returns of 14.5% and 9.8%, respectively. That's particularly impressive given most professional money managers underperform the S&P 500.

Hohn added to his stake in Microsoft (MSFT 0.55%) in the second quarter, and it now ranks as his second-largest holding. Meanwhile, Tepper started a position in Salesforce (CRM 0.33%), making it his fourteenth-largest holding. Since these fund managers have strong track records, investors should take a close look at both stocks.

Here's why Microsoft and Salesforce look like smart long-term investments.

Microsoft: Mission-critical software and services

Microsoft has the kind of brand authority that few businesses ever achieve, and that success is due in large part to the mission-critical nature of its productivity software. Microsoft 365 (think Word, Excel, and Outlook) is the most popular enterprise software suite of any kind, and Microsoft Teams ranks as a leading cloud communications platform, according to research company Gartner.

Microsoft is also a key player in the cloud computing and video game markets, and its strength across all those categories has fueled consistently solid financial results. Over the past year, revenue rose 18% to $198 billion, and free cash flow (FCF) climbed 16% to $65 billion. More importantly, investors have three good reasons to believe that momentum will continue.

First, Microsoft is a key player in cybersecurity, especially in endpoint protection and access management, and the company is taking share across every major category it serves. Better yet, the cybersecurity industry is expected to grow 11% annually to reach $539 billion in 2030, according to Statista. That should be a powerful tailwind for the company.

Second, Microsoft Azure is gaining momentum in cloud computing. It captured 24% share in the cloud infrastructure market in the most recent quarter, up from 22% last year, putting Azure firmly in second place behind Amazon Web Services. Microsoft's strong portfolio of data and artificial intelligence services should continue to drive adoption as the cloud-computing market grows to an estimated $1.6 trillion by the end of this decade.

Third, the company is quietly building a strong presence in digital advertising. Last year, it acquired ad tech platform Xandr from AT&T, adding sophisticated buy-side and sell-side tools to its portfolio. More recently, Netflix selected Microsoft as its exclusive ad tech and sales partner for its ad-supported streaming service, which could launch as early as this year.

In a sense, Microsoft is the glue that holds many enterprises together, from productivity and communications tools to cybersecurity software and cloud infrastructure. That's why this stock is worth buying.

Salesforce: The CRM market leader

Salesforce dominates the customer relationship management (CRM) space. Its AI-powered platform comprises a suite of software products that drive productivity across marketing, sales, commerce, and customer service. The company also provides tools for data analytics, workflow automation, and low-code application development. Collectively, those solutions help businesses provide an exceptional customer experience across all stages of the customer journey.

Salesforce holds approximately 24% market share in CRM applications, according to the IDC, more than the next four competitors combined. That monster lead is due in part to consistent innovation as Salesforce regularly releases new software products and features. For instance, it recently introduced Salesforce Easy, a simplified CRM suite for small businesses.

Turning to the financials, Salesforce delivered a solid performance over the past year, though growth was somewhat muted by the ongoing integration of its Slack acquisition and unfavorable foreign exchange rates. Revenue climbed 25% to $29.3 billion and FCF jumped 4% to $5.7 billion. Investors should look for FCF to grow more quickly in the coming quarters as Salesforce laps its Slack purchase.

Going forward, the future looks bright for the CRM giant. Salesforce puts its market opportunity at $248 billion by 2025, and management expects to surpass $50 billion in revenue by fiscal 2026 (ends Jan. 31, 2026), which implies annualized revenue growth of at least 16% over the next three-and-a-half years. And with shares trading at 5.3 times sales -- the cheapest valuation in the past decade -- this growth stock is a compelling buy right now.