Investing often comes down to choices. Frequently, that means buying one stock over another since most of us have limited resources.

While Amazon (AMZN 1.30%) and Apple (AAPL 0.64%) have done very well over the years, the recent bear market means this is a good chance to evaluate whether this represents a good buying opportunity.

In the battle between these two titans, which one comes out ahead?

Two people looking at a laptop monitor.

Image source: Getty Images.

Amazon

Amazon has grown from initially selling books online to offering just about everything imaginable by focusing on what the customer wants. Shareholders have been handsomely rewarded as the stock has gone from a split-adjusted price of under $1 in 1997 to over $127. However, the share price has fallen by about 24% this year after the company reported disappointing results.

Contending with higher costs, Amazon saw its second-quarter operating income fall to $3.3 billion, less than half the $7.7 billion in the year-ago period. However, after ramping up staffing and capacity to meet higher demand, management has promised to focus on productivity. And people still turn to Amazon for its quick delivery and low prices. With a Prime subscription, you even get a streaming service.

I have an even better cause for optimism. The company's Amazon Web Services (AWS) unit continues to grow sales quickly. The cloud computing division has about a 33% market share, making it the leader in this fast-growing space.

Better still, due to the major commitment required for data centers, the barriers to entry remain high. Its two competitors are Microsoft's Azure and Alphabet. In the most recent quarter, AWS' sales grew by 33.3%. The business's operating margin was 29%, up from last year's 28.3%, and it's much higher than the North American and international businesses.

With the stock price down, this seems like an opportune time to purchase shares. With the shares trading at a price-to-sales ratio of 2.7, that's more reasonable than the 3.6 multiple there were at in April.

Apple

Apple has built a large and loyal following by offering "cool" products. These include the iPhone, Mac, iPad, AirPods, and Apple Watch. It has also made shareholders happy with the price going from a split-adjusted pennies to over $155 over the last 25 years.

Due in part to the overall equity market sell-off, the stock has fallen by more than 12% in 2022, however.

Apple also didn't overwhelm investors with recent results. Its fiscal third-quarter sales grew by only 1.9% to $83 billion, and operating income dropped by 4.4% to $23.1 billion. This covered the period that ended on June 25. But the weaker sales and profitability should prove an aberration.

The iPhone, which made up 49% of the quarter's sales, grew by 2.8% to $40.7 billion. That is likely to accelerate as Apple is reported to be readying the imminent launch of its latest version. It remains a popular product, garnering a strong market share in the U.S. and abroad.

There's also the company's fast-growing services business, which saw a 12.1% top-line increase in the most recent quarter. This includes the App Store, advertising, and tech support.

The stock sells at a P/S ratio of 6.6, down from nearly eight earlier this year.

Bottom line

So which stock offers better prospects? It's a close call, but I give the edge to Amazon. Apple relies on the iPhone for nearly half of its sales, and a weak reaction, although seemingly unlikely, presents a risk. Amazon has a strong and growing AWS business while its other businesses should rebound as the company focuses on improving profitability.