(Reuters) - Costco Wholesale Corp's COST.O quarterly profit scraped past estimates, helped by a hike in membership fees, but a fall in gross margins fueled concerns of an intensifying grocer price war, sending shares down 3.6 percent in after-market trading.

FILE PHOTO: A Costco truck makes a delivery to a Costco store in Carlsbad, California, U.S., May 8, 2017. REUTERS/Mike Blake/File Photo

Investors are wary that Costco's business model, which mainly generates revenue through a niche membership club, faces increased competition from online giant Amazon.com Inc AMZN.O, which has begun to shake up the grocery space with its acquisition of Whole Foods.

Gross margins in the fourth quarter were lower year-over-year by 15 basis points, as the retailer spends to drive sales and member loyalty, Costco said on a post-earnings conference call on Thursday.

“We believe near-term sentiment and fear of the long-term impact of Amazon on Costco’s business could continue to create an overhang on COST shares and limit valuation upside,” BMO Capital Markets analysts said in a pre-earnings client note.

Costco’s shares have fallen 7.2 percent since the Amazon-Whole Foods deal was announced in June.

MEMBERSHIP FEE HIKE

Costco implemented its annual membership fee increase by $5-$60 for Goldstar and business members, and by $10-$120 for executive memberships in the quarter.

Membership fees, which accounted for about 72 percent of Costco’s operating income in 2016, rose 13 percent in the 17-week fourth quarter ended Sept. 3.

Excluding the impact of fuel and currency fluctuations, total comp sales rose 5.7 percent, while analysts at research firm Consensus Metrix expected an increase of 5.1 percent.

Costco’s U.S. comp sales rose 5.8 percent in the quarter.

Net income attributable to Costco rose to $919 million, or $2.08 per share, from $779 million, or $1.77 per share.

Total revenue rose 15.7 percent to $42.30 billion.

Analysts on average had estimated earnings of $2.02 per share and revenue of $41.55 billion, according to Thomson Reuters I/B/E/S.