The COVID-19 pandemic provided a huge boost for Costco Wholesale (COST 1.06%). People who were eating at home more frequently found buying in bulk attractive. Moreover, consumers have ramped up spending on discretionary and big-ticket items like home furnishings, sporting goods, furniture, electronics, and appliances (all of which Costco carries).

Some of the warehouse club giant's earnings tailwinds have started to abate in recent months. Nevertheless, Costco reported impressive earnings results for the final quarter of its 2021 fiscal year last week. Let's take a look.

Gross margin gains start to subside

For most of fiscal 2021, Costco logged strong increases in core gross margin. The fresh foods department led the way, as surging customer traffic and sales reduced food waste and boosted labor productivity for prepared foods.

That trend shifted in the fourth quarter. Although traffic to Costco's warehouses remained quite strong -- adjusted comparable sales rose 9.4% -- the company faced a tough year-over-year comparison. Meanwhile, inflation has been heating up across a wide variety of products. Costco has passed some price increases through to its customers, but it has worked to delay or mitigate those increases. This caused Costco's core gross margin as a percentage of core sales to decline by 0.4 percentage points year over year last quarter.

On the bright side, Costco's ancillary businesses are recovering rapidly after getting hit hard by the pandemic. Improving margins there offset most of the gross margin pressure in the retailer's core merchandise categories. As a result, reported gross margin decreased by 0.32 percentage points year over year.

Earnings still exceeded expectations

Despite increasing gross margin pressure -- particularly in fresh foods -- Costco easily beat the analyst consensus for earnings per share last quarter. EPS totaled $3.76, and excluding an $84 million pre-tax write-off of technology assets, EPS would have reached $3.90. This beat the average analyst estimate of $3.57 by 9%.

The entrance to a Costco warehouse.

Image source: Costco Wholesale.

A year ago, Costco posted Q4 EPS of $3.13, or $3.04 excluding a pair of special items. That result included $0.47 per share of incremental pandemic-related costs.

In other words, the removal of the pandemic-related costs that Costco incurred during 2020 drove the majority of the company's earnings growth last quarter. However, strong sales growth also boosted its underlying earnings, despite a modest amount of margin pressure.

Membership fee growth is the key

The most impressive aspect of Costco's performance last quarter (and throughout fiscal 2021) was its membership fee growth. Fee income has historically accounted for the bulk of the company's earnings. Last quarter, membership fee revenue rose 11.7% year over year to $1.23 billion. Even excluding the benefit of a weaker U.S. dollar, membership fee income increased 9.7%.

Costco ended fiscal 2021 with 61.7 million paid member households. That represented a 6.2% increase from the 58.1 million members it had at the end of fiscal 2020. Moreover, as spending per household has risen, the executive membership -- which costs twice as much but offers 2% cash back on most purchases, among other perks -- has become more attractive for many Costco shoppers. The number of executive members jumped 13.3% last year to 25.6 million.

Membership fee income could continue to grow at a strong pace over the next few years. First, Costco's always-strong renewal rate improved further last year. Second, the company plans to open more warehouses in fiscal 2022 than it did over the past year. That includes some key openings in international markets, which tend to have more members per warehouse. Third, based on historical precedent, Costco is likely to raise its membership fees sometime next year. That would turbocharge the growth rate of fee income.

While inflation (and Costco's efforts to hold down prices) could cause gross margin compression this year, those changes would likely be temporary. By contrast, membership fee income has proven to be very durable over the years. That makes Costco's strong membership fee growth a great sign for the future.