(Reuters) - Costco Wholesale Corp's COST.O gross margins fell in the first quarter, as the warehouse operator paid higher wages, ramped up investments in its online business and cut prices amid intense competition in the grocery industry.

Shopping carts are seen at a Costco Wholesale store in Glenview, Illinois, U.S. May 24, 2016. REUTERS/Jim Young/File Photo

Costco shares, which have gained 21.7 percent this year, were down 3.2 percent at $219.13 in extended trading on Thursday.

Higher gas prices also pressured gross margins, leading to a 50 basis points drop to 10.75 percent in the first quarter ended Nov. 25. Excluding gas, margins fell 26 basis points.

Costco, which sells everything from personal computers to groceries, has been adding more organic and fresh food products as it takes on Walmart's WMT.N Sam's Club, which after shutting some stores last year has amped up competition.

“We’ve seen a little bit more margin pressure as there’s been a little bit more retail competitive pressure out there, not only from supermarkets but Sam’s as well,” Costco Chief Financial Officer Richard Galanti said, referring to its grocery business.

Costco also raised hourly minimum wages for about 130,000 store employees by $1 to between $14 and $14.50 in June, as it becomes harder to find workers in a tight job market.

The wage increase in part drove overall, selling, general and administrative expenses up 11 percent.

Still, total revenue rose 10.2 percent to $35.07 billion, beating analysts’ average estimate of $34.80, according to IBES data from Refinitiv.

Sales at established stores, excluding the impact of fuel and currency changes, rose 7.5 percent, well above estimates of 5.8 percent.

“Costco’s Q1 results reflect the company’s prudent strategy of short-term investments for long-term benefit,” said Moody’s retail analyst Charlie O’Shea.

Net income attributable to the company rose to $767 million, or $1.73 per share, from $640 million, or $1.45 per share, a year earlier.