"A weakening economy, combined with rising fuel and agricultural commodity prices adversely affected us in the quarter," Chief Executive Jim Morgan said in a statement.

The company's near-term results may continue to be "uneven," he said.

The company, once a Wall Street favorite, reported a net loss of $1.9 million, or 3 cents a share, for the second quarter ended August 3, compared with a net loss of $27.0 million, or 42 cents a share, a year earlier.

The year-ago quarter results included impairment charges and lease termination costs of $22.1 million, or 35 cents a share.

Revenue fell to $94.2 million from $104.1 million. Company-stores revenue fell about 14 percent to $65.1 million, while Krispy Kreme chain revenue fell 5 percent to $22.5 million.

Systemwide sales, which include sales by both company and franchisee stores, rose 4 percent, helped by international franchisees.

The company said as of August 3, there were 494 Krispy Kreme stores operated systemwide, of which 234 were in the United States and the rest in other countries.

One analyst expected the company to post a loss of 1 cent a share, before special items, according to Reuters Estimates.

Krispy Kreme went public in 2001 with a successful offering, but in recent years struggled with restatements, investigations into its past accounting and a decline in doughnut sales that sent some of its franchisees into bankruptcy.

The company competes with privately held Dunkin' Brands Inc and larger rivals Starbucks Corp and Tim Hortons

.

Shares of the company closed at $4.00 Wednesday on the New York Stock Exchange.

(Reporting by Nivedita Bhattacharjee in Bangalore; Editing by Vinu Pilakkott)