Costco Wholesale Corp posted a bigger-than-expected increase in quarterly profit as the warehouse club's discounted gasoline prices lured shoppers to its service stations and stores.

Costco prices gasoline below nearby service stations. When gas prices rise, as they have recently, sales at Costco are buoyed.

At the same time, Costco is willing to take a hit to margins in order to keep its prices low so that shoppers come to its stores more often. Costco typically prices everyday goods such as bananas below supermarket prices, for example, and hopes that once shoppers come in they stock up on other goods as well.

During the fiscal second quarter ended February 12, Costco's merchandise margins fell 0.3 percentage point to 10.53 percent, which was slightly below expectations of 10.61 percent, according to Bernstein analyst Colin McGranahan.

It seems likely that underlying product margins may have declined for a second quarter as (Costco) reinvests in value and price, McGranahan said.

Shares of Costco were up 1.1 percent at $86.22 in morning trading on the Nasdaq.

BMO Capital Markets analyst Wayne Hood has an underperform rating on the shares, citing concerns about operating margin pressure and a high valuation for the stock that leaves little room for disappointment.

Shares of Costco trade at 22.1 times expected earnings, while Wal-Mart Stores Inc , whose chains include Sam's Club warehouse clubs, trades at multiple of 12.1.

TAX RATE HELPED PROFIT, ANALYSTS SAY

Costco sells everything from strawberries to sweatpants. Its members pay annual fees to shop at hundreds of large stores and online.

Selling gasoline drives revenue, but gas is less profitable than other goods. Costco has said in the past that about 30 percent of its members buy gas and shop on the same day.

Costco said second-quarter profit rose to $394 million, or 90 cents per share, from $348 million, or 79 cents per share, a year earlier.

Analysts said the earnings were helped by a lower-than-expected tax rate.

Sales in the quarter rose 10 percent to $22.51 billion.

Analysts on average were expecting a profit of 87 cents per share, on sales of $22.83 billion, according to Thomson Reuters I/B/E/S.

Second-quarter same-store sales -- sales at stores open at least a year -- rose 8 percent.

Same-store sales rose 8 percent in February, outpacing the 7.6 percent rise that analysts expected, according to Thomson Reuters data.

Excluding the impact of rising gasoline prices and foreign currency fluctuations, same-store sales rose 7 percent during both the second quarter and February.

The chain's January same-store sales rose 8 percent, excluding those factors.

Membership fee revenue rose 7.7 percent to $459 million in the quarter, Costco said. The Issaquah, Washington-based chain raised fees for most U.S. and Canadian members by 10 percent on November 1.

Last week, Wal-Mart said Sam's Club same-store sales rose 5.4 percent in the latest quarter, excluding sales of gasoline. Sam's Club total sales, including gasoline, rose 6.8 percent to $14.01 billion.

(Reporting by Jessica Wohl in Chicago. Additional reporting by Nivedita Bhattacharjee in Chicago and Eileen Anupa Soreng in Bangalore; Editing by Dan Lalor, Lisa Von Ahn and John Wallace)