Artificial intelligence is arguably the most significant trend in technology today. Among the AI sector's biggest players are Alibaba (BABA 2.56%) and Amazon (AMZN -0.38%).
Both are well positioned for AI because they are e-commerce and cloud computing giants. Their e-commerce data feeds AI learning, while their cloud services deliver the necessary computational power.
Despite the similarities in their businesses, different factors are at play when considering an investment in Alibaba or Amazon. If you had to pick one to invest in, the choice can be challenging. Here's a breakdown of the two to evaluate which is the better investment right now.

Image source: Getty Images.
Alibaba's steps toward business growth
Alibaba is going all out in pursuit of AI success. It's pouring substantial sums into tech infrastructure to support AI, leading to capital expenditures of $5.4 billion in its fiscal first quarter, ended June 30. That's more than triple the prior year's $1.6 billion capex investment.
This cost increase led to an outflow of free cash flow (FCF) totaling $2.6 billion in fiscal Q1. Alibaba's negative FCF is not a good sign, since free cash flow is important to many aspects of its business, including delivering dividend payments to investors.
But the gamble is paying off for shareholders in other ways. Alibaba stock is up more than 90% this year through Oct. 13.
AI was a contributing factor to the company's impressive share price performance. Discussing fiscal Q1 results, CEO Eddie Wu said, "With triple-digit growth in AI-related product revenue for the eighth consecutive quarter, AI-related revenue this quarter accounted for over 20% of revenue from external customers."
AI is not the only driving force in Alibaba's business growth. The company rolled out "quick commerce" across China in May. The concept involves accelerated product delivery, typically within an hour. The move proved to be a winning strategy.
Quick commerce helped Alibaba reach new highs in monthly active consumers and daily order volume. Consequently, its fiscal Q1 China e-commerce sales rose 10% year over year to $19.6 billion.
A closer look at Amazon
Like Alibaba, Amazon is investing heavily into tech infrastructure for AI, causing costs to rise rapidly. Its capex soared to $103 billion over the trailing 12 months through Q2, a whopping 87% year-over-year increase. Notably, Amazon still produced FCF of $18.2 billion over that time.
The capex spending was worth it. Amazon injected AI throughout its operations, and is providing the tech to other businesses through its cloud computing segment, AWS. This translated into Q2 AWS sales growing nearly 18% year over year to $30.9 billion.
Along with AWS, Amazon's retail division is also seeing success. This part of Amazon's business was supposed to suffer under 2025's unfavorable macroeconomic environment, such as unpredictable changes in tariff policies and its impact on consumer spending, which contributed to Amazon shares seeing less than a 1% gain this year through Oct. 13. And yet, the company's retail sales are going strong.
Q2 revenue in Amazon's North American segment rose 11% year over year to $100.1 billion while the international division saw a 16% year-over-year increase to $36.8 billion. This growth led to $167.7 billion in total Q2 revenue, up 13% compared with $148 billion in the second quarter of 2024.
Amazon's Q2 success is expected to extend into Q3. The company forecasted Q3 sales to grow between 10% and 13% year over year.
Choosing between Alibaba and Amazon stocks
With AI contributing to Alibaba and Amazon's rising sales, deciding which to invest in requires looking at additional factors. One is the forward price-to-earnings (P/E) ratio of their stocks.
Data by YCharts.
The chart shows Alibaba's forward earnings multiple has been moving up in recent months, indicating the stock is getting more expensive, but it's still below Amazon's. This suggests Alibaba stock is a better value.
That said, there are reasons for Amazon's higher valuation. For instance, Amazon's FCF remains in positive territory despite its immense AI investments, unlike Alibaba.
In addition, Alibaba's e-commerce share in China fell from more than 50% in 2021 to around 40% in 2024 as competition ate into the company's leadership. Meanwhile, Amazon's e-commerce market share has slowly grown over that time, from 38% to 40%.
Finally, the current geopolitical climate should be part of the investment equation. While Alibaba's business remains strong and its AI bets are paying off, geopolitics are casting a shadow over the company.
The Trump administration's introduction of high tariffs last April roiled relations between the U.S. and China. In fact, Trump called for the delisting of Chinese stocks earlier this year.
More recently, a dispute over China's export of rare-earth metals led Trump to threaten new tariff hikes. While geopolitics impact both tech titans, any economic fallout affecting China will hurt Alibaba more than Amazon, since China is Alibaba's largest market, accounting for $19.6 billion of its $34.6 billion in Q2 revenue.
The unpredictable nature of U.S.-China relations right now, combined with Amazon's better FCF and growing market position, gives Amazon the edge over Alibaba as the superior stock investment.