Clothing retailer Gap Inc said profit for the latest quarter rose 40 percent even as sales at its more than 3,000 stores fell.

The San Francisco-based company, which is facing a downturn in the economy, said on Thursday it is tightly managing costs. Earnings for the first quarter grew 40 percent while total revenue fell 5 percent.

We are pleased with our first-quarter results, as we delivered solid earnings growth in a difficult environment, said Chairman and Chief Executive Glenn Murphy in a statement.

Net income for the quarter was $249 million, or 34 cents per share, up from $178 million, or 22 cents per share a year earlier. Revenue fell 5 percent to $3.38 billion.

Analysts had expected the retailer to earn 31 cents per share, according to Reuters Estimates. The company had predicted earnings between 30 cents and 32 cents.

Looking ahead, we are focused on bringing compelling product and shopping experiences to our customers while managing costs tightly.

Comparable store sales fell 11 percent in the first quarter, compared with a decline of 4 percent in the same period a year ago.

The company reiterated its outlook for the current fiscal year, expecting earnings of between $1.20 to $1.27 per share.

Shares of Gap rose 22 cents on Thursday, or 1.22 percent to $18.29.