Coming into 2017, Costco Wholesale (COST 1.68%) investors were looking for hints that the warehouse retailer would update its business model to adapt to online competitors like (AMZN -0.17%). Prior to this year, Costco had made modest changes to make e-commerce a bigger part of its business, but overall, the company is relying on its traditional strategy of opening new stores, adding members, and growing comparable sales.

Indeed, that strategy is still working, but investors are skeptical about the company's future.

A shopper moves through an aisle at a warehouse retailer.

Image source: Getty Images.

As a result, Costco's shares have increased 10.3%, but that has underperformed both the S&P 500 and closest rivals Amazon and Wal-Mart (WMT 0.83%), both of which have surged this year, as the chart below shows.

COST Chart

COST data by YCharts.

Let's take a look back at Costco's year that was and see what investors can expect in 2018.

Bucking the retail apocalypse

While much of the retail sector has floundered this year, Costco has been able to post strong comparable sales growth as its unique membership model and rock-bottom prices give it a cushion from the changing consumer habits that are buffeting many of its peers. 

In the fiscal year ended Sept. 3, Costco reported global comparable sales growth of 3.8% and 5.7% for the last quarter, not including changes in gas prices and foreign exchange. In the eight weeks since then, comparable sales have increased 6%. 

Thanks in part to a membership hike earlier in the year, earnings per share in the fourth quarter increased from $1.77 to $2.08. However, even though the company beat earnings estimates, the stock still sold off 6% after the report as gross margin fell slightly. Costco said membership renewal rates also declined a bit, though management blamed that on a switch in its credit card provider.  

Still, concerns persisted that Amazon, especially after its acquisition of Whole Foods in June, was sapping away Costco's lifeblood-membership growth. CFO Richard Galanti told analysts that the best thing Costco could do was just execute. Notably, Costco's worst day of the year came on June 16, when the stock dropped 8% on the news that Amazon would acquire Whole Foods. 

The e-commerce battle

After Galanti told analysts last year that the company wanted to make every effort to bring customers into the store, Costco is finally making efforts to step up its e-commerce game, seeing strong growth in segments like appliances, apparel, and nonperishable foods.  

In October, the company launched Costco Grocery, a two-day delivery program for nonperishable foods and sundries free with orders of $75 or more, and a separate service to offer same-day delivery on both fresh and dry goods through Instacart at 376 domestic locations. 

Those efforts are paying off as e-commerce growth is accelerating. Though it grew just 13% for the fiscal year, the figure was up 21% in the fourth quarter and 32% for the first eight weeks of fiscal 2018. 

Still, that growth is coming off such a small base that it will need to continue to accelerate in order for Costco to becoming a significant e-commerce competitor. At Wal-Mart by comparison, U.S. e-commerce sales increased 50% in its most recent quarter.

Meanwhile, investors continue to worry about the growing number of Amazon Prime members, which is now in direct competition with Costco following the Whole Foods acquisition. Amazon has even promised to give Prime members discounts at Whole Foods. 

Looking ahead to 2018, Costco's initiatives and growth in e-commerce should be a key determinant for the stock's success. While its brick-and-mortar sales remain strong, the Amazon threat is only getting bigger.

With the stock up 10% this year, 2017 isn't totally a lost year, but like Wal-Mart, Costco needs to transition into its next phase as a retailer if the stock is to continue to thrive.