Shares of Costco Wholesale skidded 6.8 percent Friday after the company reported weaker-than-expected earnings amid increased competition.

The fresh-grocery business is getting increasingly more competitive, putting more pressure on Costco's profit margins as it tries to keep up with rivals like Amazon's Whole Foods and Walmart's Sam's Club. Costco's stock is up 21.7 percent from the year, holding its own against those retail giants, whose market values dwarf the wholesaler's $99.3 billion.

"There's been a little bit more retail competitive pressure out there, not only from supermarkets but Sam's as well," CFO Richard Galanti said during the quarterly conference call Thursday. "We've got good fresh sales numbers, but we — like others — our competitors are working in a little lower margin."

The company earned $1.61 per share during its first quarter, excluding certain items, missing Refinitiv estimates of $1.62 per share by a penny.

Costco generated better-than-expected revenue, $35.1 billion, beating Wall Street estimates of $34.8 billion.