MINNEAPOLIS — Supervalu returned to a profit in its fiscal second quarter after posting a loss in the same period a year ago due to a large charge.

Its adjusted profit and revenue beat analysts' expectations. Shares climbed more than 6 percent premarket trading Thursday.

The grocer earned $40 million, or 15 cents per share, for the period ended Sept. 7. That compares with a loss of $111 million, or 52 cents per share, a year ago.

Taking out a charge related to a legal settlement and after-tax income tied to the sale of distribution center, earnings from continuing operations were 13 cents per share.

Analysts, on average, expected earnings of 12 cents per share, according to a FactSet survey.

Supervalu's stock rose 57 cents, or 6.8 percent, to $8.87 in premarket trading about 90 minutes ahead of the market opening.

The prior-year period had included $36 million in charges mostly related to store closings, asset impairments and a write-off of some loans costs.

Supervalu has been shedding some businesses in a bid to offset declining sales and overcome intensifying competition. Earlier in the year it sold five of its chains to an investor group for $3.3 billion, including debt.

Revenue rose slightly to $3.95 billion from $3.94 billion. Wall Street forecast $3.88 billion in revenue.

Save-A-Lot sales dipped to $972 million from $973 million as network same-store sales declined slightly. The figure climbed 4.6 percent for company-run stores open at least a year.

Supervalu has 1,334 Save-A-Lot stores.

Sales for the retail food segment slipped 1 percent mostly because same-store sales edged down 0.9 percent. The company has 191 traditional retail grocery stores.

Sales for the independent business — which includes 1,900 independent stores— fell 1.6 percent on lower sales to existing customers, including the military. This was somewhat offset by new business.

Gross profit margin improved, benefiting from reduced infrastructure costs and an increase in fees earned under transition services agreements with Albertsons LLC and New Albertsons Inc.

Supervalu Inc. has about 3,420 stores in total.