Costco Wholesale Corp posted a bigger-than-expected rise in quarterly profit on Wednesday, as rising gasoline prices led more members to fill up at the warehouse club's discounted gas stations and then shop inside.

Rising gasoline prices had a positive impact on sales at Costco, which prices its fuel below nearby stations.

Sales at stores open at least a year, or same-store sales, rose 8 percent in February, outpacing a 7.6 percent rise that analysts had expected, according to Thomson Reuters data.

Sales rose 10 percent to $22.51 billion in the second quarter that ended on February 12, from $20.45 billion a year earlier.

Analysts on average were expecting $22.83 billion, according to Thomson Reuters I/B/E/S.

The company sells everything from strawberries to sweatpants to its members, who pay annual fees to shop at hundreds of large stores and online. Costco has said in the past that about 30 percent of its members buy gas and shop on the same day.

For the second quarter, Costco said earnings had risen to $394 million, or 90 cents per share, from $348 million, or 79 cents per share.

Analysts on average were expecting a profit of 87 cents per share.

Costco's shares were up 0.5 percent at $85.70 in premarket trading.

(Reporting by Nivedita Bhattacharjee in Chicago Eileen Anupa Soreng in Bangalore; Editing by Lisa Von Ahn and Maureen Bavdek)