Amazon (AMZN -1.45%) currently sports a market cap of $2.4 trillion. On the other hand, Apple's (AAPL -1.32%) valuation sits above $3.7 trillion. These are two of the most dominant tech enterprises on the face of the planet.

Both of these "Magnificent Seven" stocks trade in record territory. But investors might still have each on their watch lists as a place to park their capital. Between Amazon and Apple, which is the best to buy right now?

Multiple growth engines

Amazon might be a massive corporation that generated a whopping $575 billion in trailing 12-month sales, but its expansion is not anywhere close to being done. The business benefits from multiple growth engines propelling it forward.

Online shopping continues to grow relative to physical retail, and Amazon is the key beneficiary of this secular trend. The company's e-commerce marketplace is responsible for nearly 40% of all online sales in the U.S., way ahead of the next-highest business, which is Walmart.

Amazon Web Services (AWS), the company's leading cloud computing platform, has top market share among rivals. This segment gains from corporate interest in moving IT capabilities to the flexible and cost-friendly environment of off-premises computing. Additionally, the need to integrate artificial intelligence tools makes AWS a mission-critical partner for many of its clients.

Grand View Research believes the global cloud market will expand 21% per year to be worth $2.4 trillion in 2030. So AWS should see durable growth for a very long time.

Amazon has also rapidly become a dominant player in digital advertising. These services raked in $14.3 billion in revenue just in the last three months, which was up 19% year over year. Because Amazon.com attracts billions of visitors each month, coupled with the success of Prime Video, the company garners a lot of views that advertisers want to take advantage of.

Incredible brand strength

There is arguably no brand on the face of the planet as powerful as Apple. A long history of developing in-demand hardware products supported by easy-to-use internal software has made this business a consumer favorite. Customers line up outside retail stores when devices are released, even if newer models don't offer up game-changing updates.

Apple's brand strength is clear when examining its pricing power. The company posted a 37% gross margin in fiscal 2024 on the sale of products. That indicates how profitable this segment is, even though selling hardware devices is usually not a lucrative business model. People don't really hesitate to spend a four-figure sum on a new iPhone.

The brand is further supported by Apple's ecosystem. In the past few years, services like iCloud, advertising, Pay, and Music+, for example, have posted faster revenue gains than products. The popularity of the company's services keeps users engaged and locked in, discouraging switching to competing offerings.

Investors who buy Apple shares will sleep well at night. That's because the company faces no financial risk. Apple generated a massive $94 billion in net income last fiscal year, which helped it produce $118 billion in operating cash flow. Add this enormous profitability to a fortress balance sheet, and there is little chance Apple will run into financial troubles anytime soon.

Valuation matters

Investors must incorporate valuation analysis when deciding what stocks to buy. As of this writing, shares of Amazon trade at a forward price-to-earnings (P/E) ratio of 44.5. That's 34% higher than Apple's multiple of 33.3.

Amazon's valuation is more expensive than Apple's. But when you consider that the former is projected to grow its earnings per share over the next couple of years at an annualized pace almost double that of the latter, you quickly realize that the P/E multiple isn't as elevated as it seems at first glance.

Apple has undoubtedly been a fantastic stock to own in the past. But I wouldn't be surprised if its shares underperformed the broader S&P 500 over the next five years, mainly because of the high starting valuation and softer growth prospects.

In my opinion, Amazon looks like the better stock to buy right now. The potential to generate strong investment returns is more obvious.