You may be surprised to know that in 2019, the stock of Amazon.com (NASDAQ:AMZN) lagged behind many of its large-cap tech peers, as well as the broader market. However, it looks as if that may have set the stage for a 2020 outperformance. Last night, Amazon reported its fourth-quarter earnings, which handily beat analyst expectations on both revenue and earnings-per-share estimates, and sent the stock up nearly 10% after hours.

However, it wasn't just the revenue and earnings beats in and of themselves that were so impressive, but rather the soft retail environment in which Amazon achieved these outstanding numbers. Outperforming in the face of macroeconomic slowing only served to put Amazon's competitive advantages over rivals on full display, and gave Amazon's management lots of credibility that its 2019 spending surge was more than justified.

A woman in professional attire looks surprised as she drinks from a cup and reads a newspaper.

Amazon surprised to the upside even in a soft retail environment. Image source: Getty Images.

Stunning growth for its size

For the quarter, the e-commerce and cloud giant saw revenue increase 20.8% to $87.4 billion, marking an acceleration over the prior year and beating analyst estimates by $1.35 billion. Meanwhile, earnings per share of $6.47 handily beat expectations of only $3.96.

The breakdown in Amazon's growth by product segment looks like this:

Amazon Segment

Q4 2019 Growth (YOY, excluding FX)

Q4 2018 Growth (YOY, excluding FX)

Online stores

15%

14%

Physical stores

(1%)

(3%)

Third-party seller services

31%

28%

Subscription services

32%

26%

Other

41%

97%

Amazon Web Services

34%

46%

Total

21%

20%

Data source: Amazon Q4 2019 earnings release. YOY=year over year.

Clearly, the company's aggressive investments in one-day shipping starting in the second quarter of 2019 are beginning to pay dividends, with accelerating year-over-year growth in the company's already-huge retail operations.

One-day shipping appears to be generating the intended network effects. One-day shipping attracts more Prime subscriptions, benefiting the subscription services line. That, in effect, attracts more third-party sellers to Amazon's platform. Both of those high-margin categories accelerated over 2018.

And the more eyeballs you have on the platform in general, the more digital advertising dollars will also come in the door. That high-margin category, in which Amazon is rapidly gaining market share, is grouped under the "other" category. While that growth figure did decelerate from last year's massive gains, the law of large numbers does dictate that this category is unlikely to grow at 97% perpetually. Meanwhile, the impressive 41% growth rate did mark an acceleration over the 36% and 37% "other" growth rate the first and second quarter of 2019, before one-day shipping fully kicked in.

So while one-day shipping did come with huge surge in shipping costs, up 43% on the year versus 23% growth in the year-ago quarter, the beneficial surge in higher-margin businesses across third-party services, subscription services, and advertising clearly led to better-than-feared margins for the company overall.

And consider the soft macro environment

Not only did Amazon's revenue growth come in better than expected, but the Bureau of Economic Statistics released fourth quarter data earlier yesterday, showing that U.S. consumer spending was actually somewhat softer than expected, rising just 1.8% in the December quarter. While that was a slight acceleration over the 1.4% growth of Q4 2018, the acceleration can be attributed to higher spending on services. Meanwhile, durable and non-durable goods combined decelerated from 1.6% growth in Q4 2018 to just 1.2% in Q4 2019. And the fourth quarter's 1.8% total consumer spending growth was well below the 4.6% growth in the second quarter and 3.2% growth in the third quarter.

While this would be surprising to hear based on Amazon's results, rival Target (NYSE:TGT) negatively surprised earlier this month, as its fourth-quarter same store sales underwhelmed analyst targets. And Target had been one of the better retail performers over the past year. Therefore, it appears that Amazon's unrivaled capabilities in e-commerce and one-day shipping is beating out even the best of its well-managed rivals.

Not only that, but Amazon also faced strong headwinds in its international segment last quarter. Japan, one of Amazon's main international markets, raised its national consumption tax from 8% to 10% on Oct. 1, which management said pulled sales into Q3 from the Q4 holiday season. And in India, another main international market for Amazon, the Diwali holiday occurred partially in the third quarter this year, whereas it is usually entirely within the fourth quarter most years.

Running against the wind

So even in the face of softer consumer goods spending in the U.S., along with international headwinds outside of Amazon's control, the company still managed to post accelerating growth in most of its retail segments, and clearly outdid rivals last quarter. Thus, it's no surprise to see Amazon trading up 10% after hours, and it's why 2020 is shaping up to be a better year for this top stock.