Sears Holding Corp reported a quarterly loss on Thursday instead of the profit Wall Street was expecting as the retailer struggled to cut costs to keep up with falling revenues, and its shares fell nearly 13 percent.

The company controlled by hedge fund manager Edward Lampert said its net loss was $94 million, or 79 cents per share, in the second quarter ended August 1, compared with a year-earlier profit of $65 million, or 50 cents per share.

Excluding the cost of closing stores and other special items, the loss was 17 cents per share. Analysts on average were expecting a profit of 35 cents.

Sales at the company's Sears, Roebuck and Co department stores continued to suffer from the crash of the U.S. housing market, which has sapped demand for its Craftsman tools and Kenmore appliances.

Sales at Sears stores that have been open for at least a year fell 12.5 percent, while Kmart's same-store sales slid 3.9 percent. Overall, same-store sales fell 8.6 percent, and the decline accelerated after slowing during the past two quarters.

While the overall retail market remains difficult and its impact is reflected in our results, we continue to take actions to increase the efficiency of our operations, said interim Chief Executive Officer W. Bruce Johnson.

While the company cut total costs and expenses 8 percent, revenue fell 10.3 percent to $10.55 billion.

Analysts on average were expecting revenues of $10.73 billion, according to Reuters Estimates.

The Hoffman Estates, Illinois-based company has been focused on cutting costs through better management of its inventory and other expenses. It said it decided to close 28 stores during the quarter, out of about 3,900.

Sears continued its share buyback program, spending $94 million during the quarter. It said it still had authority to buy $371 million of its shares.

Moody's cut Sears credit rating deeper into junk territory earlier this year, citing the company's share buybacks as well as weak apparel sales.

The company ended the second quarter with $1.3 billion in cash, down from $1.5 billion a year ago.

Shares of Sears were down 12.8 percent at $64.33 in trading before the market opened.

At Wednesday's close, the stock had risen about 80 percent this year, outperforming shares of rivals such as J.C. Penney Co Inc , Kohl's Corp and Wal-Mart Stores Inc .

(Editing by Lisa Von Ahn)