Costco Wholesale whizzed past analysts' estimates for quarterly profit on Thursday as the warehouse club operator's margins were lifted by a drop in gas prices and a shift to lower-cost sourcing, sending its shares up 5 percent.
The company also said pricing pressure on its groceries business had decreased, adding to the upbeat sentiment.
A highly competitive U.S. grocery industry, coupled with the looming threat of Amazon.com expanding its presence in the space, forced Costco and other grocers to slash prices last year and to invest heavily in stores and online.
Kroger, one of the largest grocery chains in the United States, said earlier on Wednesday that it would spend up to $3.2 billion to overhaul stores and improve its online business.
Costco has also bolstered its delivery operations and offers same-day grocery delivery with Instacart.
The company is investing on strengthening its online business, sprucing up its website with everything ranging from Apple MacBooks to La Mer cosmetics.
The efforts paid off, with online comparable-store sales, excluding the impact of fuel price and currency changes, rising 25.5 percent in the second quarter ended Feb. 17.