Costco Wholesale reported better-than-expected quarterly earnings Wednesday as low gasoline prices and promotions helped the grocery store club chain compete. 

Profit rose 17 percent, to $496 million, or $1.12 per share, from the year-earlier period. Analysts polled by Thomson Reuters had expected profit of $1.09 per share. Costco's annual membership fees and items offered in bulk tend to attract wealthier customers than competitors Wal-Mart and Target.

Costco is also one of the largest fuel retailers in the U.S. Lower gasoline prices likely helped boost the company's earnings because it can quickly sell the gasoline it buys, and the cheaper fuel leaves its customers with more disposable income to spend in its warehouses.

The retailer reported a 7 percent rise in same-store sales, excluding fuel. Analysts polled by research firm Consensus Matrix had expected only a 5.8 percent rise for this metric. Net sales rose 7 percent, to $26.28 billion, while total revenue, which includes membership fees, rose 7 percent to $26.87 billion. Analysts polled by Thomson Reuters had expected revenue of $26.92 billion. Wal-Mart, in comparison, reported a 0.5 percent rise in U.S. same-store sales in its latest quarter, which ended the company's six-quarter streak of flat or declining same-store sales in the region.

Costco's sales increase over the quarter was driven by traffic in U.S. stores, with only 1 percent of sales growth occuring outside the U.S. But Costco is looking to change that. The company announced in October that it would open an online store in China through Alibaba Group's Tmall marketplace to provide customers in China with branded products such as food and health care goods and products from its own private-label business.