Microsoft (MSFT 0.74%) and International Business Machines (IBM 0.13%) have been foundational technology companies for decades, and each has had to adapt to the shifting tech landscape over the past few years.  

Both companies have made missteps along the way, but both of these tech giants are still evolving, and there's still plenty of value in their businesses that investors shouldn't overlook. So let's take a closer look at each company to see which is the better buy right now. 

The case for Microsoft 

One of the most compelling reasons to invest in Microsoft right now is the company's position in cloud computing. Microsoft holds the No. 2 spot in the public cloud computing market with its Azure service, and it has successfully cut into Amazon's leading cloud position over the past few years.  

A woman working in a computer server room.

Image source: Getty Images.

Back in 2016, Microsoft held just 7% of the cloud infrastructure market, while Amazon had 44%. But at the end of 2020, Microsoft's position has jumped to 20%, while Amazon's has fallen to 32%.  

Why does this matter? Because the cloud infrastructure market is worth about $82 billion right now, and it will reach an estimated market size of $107 billion by next year. With its strong position in the cloud infrastructure market already firmly in place, Microsoft should continue to easily benefit from this market's growth in the coming years. 

In addition to the company's growing cloud infrastructure opportunity, Microsoft is also a leading cloud services player. The company now has an impressive 200 million monthly active commercial Microsoft 365 customers.  

Microsoft's years-long transition to cloud computing has been a lucrative decision not just for the company, but also for its investors. The tech company's share price has spiked 413% over the past five years, more than four times the S&P 500's gains.

The case for IBM

There's no getting around the fact that IBM has been slow to adapt to the cloud computing market. Microsoft and other competitors have easily outpaced IBM in this space over the past few years, leaving IBM playing catch-up. 

But IBM made significant strides two years ago when the company purchased Red Hat for $34 billion. Red Hat is a leader in hybrid cloud technology -- loosely defined as a network for both private and public cloud computing -- and the purchase has given IBM access to a massive $1 trillion market opportunity.

To help the company fully tap into this huge market, IBM is spinning off its infrastructure business, which is growing slower and isn't as profitable as hybrid cloud software sales. IBM CEO Arvind Krishna said on a recent earnings call, "I have immense confidence in our strategy around the transformative power of hybrid cloud and AI and the decisive moves we are making provide a solid foundation for us to unlock future growth." 

Krishna added that for every dollar spent on hybrid platforms, customers spend $3 to $5 for software and $6 to $8 on services. This means that once IBM can get customers using its hybrid cloud platform, it's much more likely to get them to spend much more money on additional services.  

IBM hasn't fully completed its transition to the hybrid cloud, but the steps the company has already made are putting the company in a strong position to benefit from this lucrative market in the coming years. 

The verdict: Microsoft is a better buy right now

While IBM is clearly making some impressive moves to turn itself around, the fact remains that the tech giant has moved much slower into high-growth opportunities than Microsoft. 

While IBM was still focusing on some of its legacy businesses, Microsoft was busy transitioning to the cloud. Microsoft's rapid shift from a software company to cloud computing has allowed it to become a leading public cloud computing company. Meanwhile, IBM is still in the early stages of its metamorphosis. 

IBM may end up being a great turnaround play, but based on where these two companies are right now in their respective markets, Microsoft's cloud computing strategy is already paying off and has created a compelling investment opportunity for investors.