A stock market sell-off in 2022 led shares in Amazon (AMZN 1.30%) and Alphabet (GOOG 1.25%) (GOOGL 1.27%) to plunge between 40% and 50% since last January. Macroeconomic headwinds brought declines in the companies' respective industries, dragging their stocks down.

However, Amazon and Alphabet continue to have leading market shares in lucrative industries and have promising outlooks over the long term. Market declines have only made their stocks more attractive.

While both of these stocks are great picks to buy now and hold indefinitely, one is currently the better buy. Let's find out which one. 

Amazon 

After stellar stock growth in 2020 and 2021 resulting from pandemic lockdowns that saw consumers overwhelmingly choose Amazon for their shopping needs, reopenings in 2022 led the company's shares to plunge 50% year over year. Like many tech and e-commerce companies, Amazon's stock and quarterly results in 2022 suffered from almost unfair comparisons to the previous year. However, 2023 might be a path toward redemption.

In the third quarter of 2022, Amazon's e-commerce business suffered as its North America segment hit $78.8 billion in revenue, rising 20% year over year, and operating income came to a negative $412 million. Meanwhile, foreign currency changes resulting in an unusually strong dollar led its international segment to report a 4.8% decrease in revenue and $2.4 billion in operating losses. 

Amazon has responded to its losses throughout the last year with cost-cutting measures such as letting go of 10,000 corporate employees, closing or canceling dozens of warehouses, and shutting down projects such as its healthcare start-up Amazon Care. 

The company's e-commerce performance in 2023 will be contingent on the economic climate, which a looming recession may bring down further. However, this is where Amazon's diverse business comes in handy. The most attractive part of Amazon is its cloud computing service Amazon Web Services (AWS), which held a leading 34% market share as of Q3 2022.

The cloud platform earned 100% of Amazon's operating income in Q3 2022, with AWS reporting a revenue rise of 27% year over year to $20.5 billion and operating income of $5.4 billion. Cloud computing is a quickly growing industry worth $368.97 billion, expected to have a compound annual growth rate of 15.7% through 2030.

It will take time for Amazon's e-commerce business to begin seeing profits again, especially if a recession brings further declines. However, its budget cuts and thriving cloud computing business could keep the company growing as temporary economic headwinds run their course. An investment in Amazon is no doubt a long-term one, but it could pay off in the end. 

Alphabet 

Rising inflation and interest rates over the last year led many businesses to pare down budgets, with advertising one of the first things to go. As a result, a decline in digital ad spending in 2022 brought Alphabet shares down 39% over the last 12 months. However, short-term market declines don't dampen the tech titan's positive outlook.

Although nearly 80% of Alphabet's revenue comes from ads on platforms such as Google, YouTube, and Android, the company continued to report revenue growth. In the third quarter of 2022, revenue increased 6% year over year to $69 billion, with operating income hitting $17.1 billion.

Despite slight declines in YouTube ads and Google Network, marginal growth for search, advertising, and services was between 2.4% and 4.2%. Meanwhile, the quarter's brightest spot was the Google Cloud segment, which increased 37.6% to $6.8 billion.

Recent market declines in digital advertising may be concerning, but Alphabet's leading 28% market share is still incredibly promising for its long-term future. Research from Omdia estimates the digital advertising market was worth $190 billion in 2022 and will almost double to $362 billion by 2027. Alphabet is well-positioned to see significant gains from the market's growth. 

Comparing Alphabet and Amazon more directly, the Google parent's free cash flow stood at $62.5 billion as of Sept. 30, while Amazon reported a negative $26.32 billion. When comparing price-to-earnings ratios, Amazon's sits at 77 while Alphabet's is at about 18, suggesting its current stock price offers considerably more value.

Amazon is a great stock to buy and hold for the very long term, even as its short-term prospects feel slightly murky. However, Alphabet is undeniably the better buy today. The digital advertising market may have suffered from poor macroeconomic conditions in 2022, but it's unlikely to be down for long.

In the past couple of months, streaming giants like Netflix and Walt Disney have heartily embraced digital ads by introducing ad-supported tiers to their platforms. The potential for other companies to similarly use ads to reduce consumer fees is endless, making Alphabet's stock a no-brainer buy.