Apple recently became the first $3 trillion company. The iPhone maker reached that historic milestone last month, about five years after it became the first $1 trillion company, but Apple is unlikely to remain the only club member for long.

Here's why Amazon (AMZN 3.90%) and Alphabet (GOOG -0.11%) (GOOGL -0.08%) could achieve $3 trillion valuations by 2030.

1. Amazon

After struggling through several quarters marred by high inflation and cautious consumers, Amazon reported encouraging results in the second quarter. Revenue climbed 11% to $134 billion, an acceleration from 7% growth in the prior year, and GAAP net income improved to $6.7 billion, up from a loss of $2 billion. Amazon is well positioned to maintain that momentum, so much so that its market cap could rise 112% to $3 trillion by 2030.

The case for hitting $3 trillion in that timeframe centers on growth prospects in three markets: e-commerce, digital advertising, and cloud computing. Amazon runs the most popular online marketplace in the world, and the company has fortified its leadership by constructing a logistics network so large it rivals that of UPS. The warehouses, trucks, and planes allow Amazon to provide fulfillment services to sellers and fast delivery to buyers, making its marketplace even more attractive.

Amazon has turned its success in e-commerce into a thriving ad tech business. The company will account for 8% of global digital ad spend next year, up from 1.8% in 2017, according to eMarketer. Those market share gains can be attributed almost entirely to its online marketplace, which excels at engaging shoppers, making it an attractive venue for advertisers. For that reason, its ad tech business should continue to flourish for as long as its marketplace remains the gold standard in e-commerce.

Finally, Amazon Web Services (AWS) is the market leader in cloud computing. It accounted for 32% of cloud infrastructure and platform services in the second quarter, meaning it captured nearly twice as much market share as its closest competitor, Microsoft Azure. That success stems from an unparalleled portfolio of cloud services, including the "broadest and deepest" portfolio of artificial intelligence (AI) and machine learning services, according to AWS' Machine Learning Blog. AWS is leaning into that success with Bedrock, a service that gives developers access to the large language models necessary to build generative AI applications.

Here's the bottom line: Online retail, ad tech, and cloud computing sales are expected to grow at roughly 14% annually through 2030, so Amazon should have no trouble matching that pace. Assuming that happens, its market cap could reach $3 trillion by the end of the decade, even if its valuation fell to 2.1 times sales. For context, shares currently trade at 2.7 times sales, which itself is a discount to the three-year average of 3.3 times sales. That makes this growth stock a screaming buy.

2. Alphabet

The downturn in ad spend driven by economic uncertainty continued to weigh on Alphabet in the second quarter, but weakness in that portion of the business was offset to some degree by strength in Google Cloud. Total revenue increased 7% to $74.6 billion and GAAP net income jumped 19% to $1.44 per diluted share. But Alphabet has a great shot at accelerating sales growth as ad spend normalizes in the future, and its market cap could climb 84% to $3 trillion by 2030.

The case for hitting $3 trillion in that timeframe hinges on growth prospects in two markets: digital advertising and cloud computing. Alphabet owns six products that serve over 2 billion users, including Google Search and YouTube. Those products underpin an unparalleled ability to engage consumers, and advertisers clearly find that valuable. Alphabet is the largest ad tech company in the world.

Meanwhile, Alphabet has taken market share like clockwork in cloud computing. Google Cloud accounted for 11% of cloud infrastructure and platform services in the second quarter, up from 8% one year ago and 6% three years ago. That momentum originates from a recently revised go-to-market strategy and continuous product development, especially where AI is concerned. Google has been recognized as a leader in AI infrastructure, cloud AI developer services, and conversational AI platforms.

Alphabet hopes to build on its AI expertise with Duet AI, an application that leans on generative AI to automate a wide variety tasks. For instance, Duet can compose text in Google Docs, generate images in Google Slides, and organize data in Google Sheets. It can also write and review code to accelerate software development workflows. Those products should help Alphabet tap into the growing demand for AI software.

Here's the bottom line: Ad tech and cloud computing sales are forecasted to grow at roughly 14% annually through 2030. Alphabet should be able to match that pace at a minimum given its strong presence in both spaces, though the company also has wildcard opportunities in AI software and robotaxi services that could lead to much faster growth. But I'll keep my estimates somewhat conservative.

Assuming Alphabet increases revenue at 14% annually through 2030, its market cap could hit $3 trillion by the end of the decade, even if its valuation fell to a dirt-cheap 3.9 time sales. For context, shares currently trade at 6 times sales, and even that is a discount to the three-year average of 6.5 times sales.