(Corrects paragraph 3 to clarify membership fees rose 3 percent to $490 million, not fell 3 percent to $474 million. Also, corrects source in paragraph 7 to Thomson Reuters data, from Thomson Reuters I/B/E/S)

Costco Wholesale Corp beat analyst expectations after posting a lower fourth-quarter profit on Wednesday, suggesting an improvement in the weak U.S. retail environment.

For the fiscal fourth-quarter ended August 30, Costco earned $374 million, or 85 cents a share, compared with $398 million, or 90 cents a share, a year earlier.

Quarterly sales fell 3 percent to $21.89 billion, excluding membership fees, which rose 3 percent to $490 million.

Analysts, on average, were expecting earnings of 77 cents per share, on revenue of $22.33 billion, according to Thomson Reuters I/B/E/S.

Sales at clubs open at least a year, a key retail gauge known as same-store sales, fell 5 percent.

Excluding the negative impacts from gasoline deflation and foreign exchange, same-store sales were up 1 percent.

Analysts were expecting a same-stores decline of 6.38 percent, according to Thomson Reuters data.

The retailer said same-store sales in September rose by 1 percent. Analysts were expecting September same-store sales to fall by 0.7 percent.

(Reporting by Biswarup Gooptu in Bangalore; editing by Simon Jessop)