It's time to stop thinking that Amazon's continued success will come at the cost of Costco (NASDAQ:COST). The warehouse club has clearly shown on a consistent basis that its membership remains loyal and that its customers won't be fleeing the chain anytime soon.

In fact, during the most recent quarter, Costco saw net sales grow by 10.8%, while sales for the first two quarters of the year were up 12%. The retailer also grew its e-commerce sales by 28.5% in the second quarter and delivered earnings per share (EPS) of 1.59, an improvement over $1.17 in the year-ago period.

Those are very strong numbers showing that recent initiatives around delivery have begun to pay off. They also prove that 2018 will be more of the same, if not better, for the wholesale club, which continues to grow its membership.

CFO Richard Galanti spoke about membership among other topics during the company's Q2 earnings call.

The exterior of a Costco with a crowded parking lot

Costco has added members and seen its retention rate improve. Image source: Getty Images.

Membership revenue rose

In June, Costco raised its membership price for the first time in over five years. That helped contribute to a year-over-year gain in membership revenue in Q2 from $636 million last year to $716 million in 2018.

Galanti explained that out of that $80 million rise, about $37 million came from hikes in Costco's fees. "The majority of the $37 million came from fee increases last June 1 in the U.S. and Canada," said Galanti. The rest of the $80 million came from new members joining.

Customer retention improved

Costco makes about 75% of its revenue from memberships. That makes customer retention one of its key metrics -- and the company delivered in Q2.

"Our renewal rates improved in Q2 to 90.1% in the U.S. and Canada, up from 90% a quarter earlier," according to the CFO. "Worldwide improved to 87.3% as of Q2 end, up 0.1% from the 87.2% at Q1 end."

Overall premium-level Gold Star membership rose to 39.6 million, up from 39.3 million at the end of the prior quarter. Primary business stayed flat at 7.5 million, while business add-ons inched up from 3.2 million at the close of the first quarter to 3.3 million at the end of Q2. Total members also climbed by 500,000 between Q1 and Q2, while total cardholders were up to 92.2 million from 91.5 million 12 weeks earlier.

Expansion will ramp up

The warehouse club opened only one new location in Q2 after adding five in the first quarter. It will add two more in the third quarter, but will finish the year with a flourish.

"Q4 is the big quarter," said Galanti. "It's a 16-week quarter, but we plan to open net 15 units. 18 openings, including 3 relos [relocations]."

Digital is growing

While Costco mostly ignored its website and apps for a long time, its efforts in that space have paid off. E-commerce sales came in at $1.5 billion in Q2, up 29% year over year. For the first half of the year, they have risen by nearly 34%, and Galanti said that the chain will keep refining its efforts.

"We continue to be helped by improved member experience with better search checkouts and return processes, as I've shared some of that with you in the past," he said. "In the quarter, our site traffic and conversion rates and orders were up nicely year-over-year."

It's all about the people

Costco has not lost ground to Amazon or any other retailer because its members have proven loyal. As long as the company carefully nurtures its relationship with its members, the retention numbers above suggest its business will remain largely immune to whatever moves its rivals make.

It's not that the warehouse club does not have to evolve. It clearly has made changes due to Amazon encroaching on its low-price space, but its base of members means it can watch the scene as it unfolds, then react to it carefully.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Daniel B. Kline has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Amazon. The Motley Fool recommends Costco Wholesale. The Motley Fool has a disclosure policy.