The stock market is showing signs of recovery after last year's economic downturn, with the Nasdaq Composite index up almost 17% year to date. Gradually easing inflation is boosting the market, making now a compelling time to invest in companies on a growth track.

Amazon (AMZN -1.65%) and Apple (AAPL 0.52%) are potent companies with nearly unrivaled dominance in e-commerce and consumer tech. Despite recent macroeconomic headwinds, these markets likely have many years of growth ahead. As a result, investing in industry leaders like Amazon and Apple after a market tumble could offer substantial gains in the long term. 

However, if you only have room for one of these companies in your portfolio, you'll need to know the better buy. So, let's assess whether you're better off investing in Amazon or Apple stock. 

Amazon: Massive potential in e-commerce

Amazon has forever altered how consumers shop, with its Prime subscription making it easy for members to make online purchases without delivery costs. In fact, Prime has gained 164 million subscribers in the U.S., about 50% of the population. The success of Amazon's e-commerce business has seen it become a household name, attaining a leading market share in the sector in multiple countries worldwide. 

The e-commerce market has struggled over the last year, with Amazon suffering considerable profit declines in 2022 amid economic challenges. However, the first quarter of 2023 suggests the industry is back on a growth path. While last quarter saw the company's North American segment report $1.6 billion in operating losses, Q1 2023 brought the business back to profitability, earning $898 million in operating income. Meanwhile, its international segment also saw a marginal improvement.

According to Statista, the e-commerce market is projected to hit $4 trillion this year and grow at a compound annual growth rate of 11.5% to achieve $6 trillion by 2027. Considering Amazon holds the largest market share in the sector, the company is well positioned to enjoy substantial revenue boosts once economic hurdles subside. 

In addition to an improving e-commerce business, Amazon's cloud platform Amazon Web Services (AWS) could see improved growth as easing inflation allows companies to expand their cloud budgets.

Apple: Unparalleled consumer loyalty 

Investing mogul Warren Buffett said last month, "If someone offered you $10,000 to never buy an iPhone again, you wouldn't take it." While surprising, the sentiment is true for millions of consumers who would give up many things before they switched smartphone brands. The company has managed to win over the public by consistently releasing quality products presented in an interconnected ecosystem.

The connectivity between Apple's devices promotes ease of use and makes it difficult for consumers to switch to competing products. As a result, Apple has achieved a leading market share in smartphones, tablets, smartwatches, and headphones.

The company's brand dominance has also paved the way for its ventures into finance and digital services. For instance, Apple debuted its first savings account last month, with users depositing almost $1 billion in its first four days. The new service expands the company's fintech business after launching a credit card in 2019.

Moreover, Apple's potent brand has boosted its services business, which includes platforms like Apple TV+, Music, iCloud, News+, Fitness+, and Arcade. The segment enjoyed revenue growth of 14% in fiscal 2022, double the iPhone's growth. Apple's reputation for premium products has helped it succeed across multiple industries and made it the world's most valuable company, with a market cap of $2.7 trillion.

As the tech giant is expected to release its first virtual/augmented reality headset this year, the new venture could see it soar to the top of a totally new market.

Is Amazon or Apple the better buy?

Amazon and Apple both make compelling buys thanks to their positions at the top of multiple growing markets. However, the chart below illustrates how Apple has offered investors far more growth in the past five years, with it potentially the more reliable investment over the long term.

AMZN Chart

Data by YCharts.

However, the argument for Amazon lies in its average 12-month price target of $138, which projects stock growth of 30%. Meanwhile, Apple's average 12-month price target of $176 would offer stock growth of 2%.

As a result, Apple is likely the better investment over the next decade, while Amazon's stock could offer larger gains over the next year.