Alibaba (BABA -4.76%) and Amazon (AMZN -1.54%) are often compared to each other because they're two of the largest e-commerce companies in the world, both dominating in their respective markets.

And with both companies building out platforms and services that are increasingly part of users' everyday lives, some investors are likely wondering which company makes the best long-term bet right now. 

A woman looking at a computer.

Image source: Getty Images.

To answer that question, let's take a closer look at how each company performed last year, and why cloud computing is helping one of these tech giants pull ahead as the better buy.

The case for Alibaba 

Alibaba reported its third-quarter fiscal 2021 results on Feb. 2, and they didn't disappoint. Revenue increased 37% year over year to $33.8 billion, and the company's adjusted EBITDA popped 22% from the year-ago quarter.

Alibaba's e-commerce platform caters to China, which is the world's largest consumer market, and it continues to do a very impressive job tapping into that space. The company reached 779 million annual active consumers -- up 68 million from the year-ago quarter.

Of course, Alibaba has more businesses than just e-commerce. Sales in the company's cloud computing business, called Alibaba Cloud, increased by 50%, and the company said that the segment reached positive adjusted EBITDA for the first time. 

Alibaba's growth, even during the global pandemic, is nothing short of impressive. But the company's share price hasn't quite kept up with that growth, as the company's stock gained just 13% over the past 12 months -- compared to the S&P 500's 47% jump. 

There's no doubt Alibaba's core e-commerce business is doing well and that the company's cloud computing segment is experiencing significant growth. But how do they stack up to Amazon?

The case for Amazon

Amazon's recent results are equally impressive. The e-commerce giant increased net sales by 44% to $125.6 billion in its fourth quarter of 2020 (reported on Feb. 2). That spike in sales helped the company's net income jump to $7.2 billion, up from $3.3 billion in the year-ago quarter. 

That strong fourth quarter helped Amazon's e-commerce sales to increase 38% in 2020 and, as Amazon founder Jeff Bezos disclosed recently, the company now has 200 million Prime members worldwide. That's an important figure to keep track of because Amazon has been wildly successful at creating a massive subscriber base that keeps customers locked into its vast ecosystem. 

Of course, Amazon has its own cloud ambitions like Alibaba. The company's Amazon Web Services (AWS) sales jumped nearly 30% for the full year to $45.4 billion, and the segment's operating income spiked 47% to $13.5 billion.   

Amazon's stock has performed better than Alibaba's, with its share price gaining about 38%, compared to Alibaba's 13% gains over the past 12 months. 

The verdict: Why Amazon is the better buy right now

There's no question that Alibaba is growing quickly and that the company's low price-to-earnings valuation of 26 right now looks cheap compared to Amazon's 79. But I think Amazon has the potential to be a better long-term buy because of the company's dominance in the cloud computing market. 

Cloud computing will be worth an estimated $397 billion by 2022, and Amazon already has 32% of the market. The company's two closest competitors are Microsoft and Google -- not Alibaba. The China-based tech giant is a large cloud player in China, but lacks the global footprint that Amazon enjoys.

Both Alibaba and Amazon are doing a good job building out their respective e-commerce businesses, but with AWS being the leading cloud player in the world and earning tons of operating income for Amazon, AWS continues to hold massive opportunities for Amazon investors that can't be overlooked. 

Even with Amazon's stock looking more expensive relative to Alibaba's, I think Amazon's cloud opportunity will continue to increase in the coming years. The fast-growing cloud business makes Amazon a more compelling long-term tech play than Alibaba right now.