A&P ( GAP) swung to a second-quarter profit due to a hefty gain on the sale of its Canadian division, but same-store sales declined.

For the quarter ended Sept. 10, the supermarket-chain operator reported earnings of $592 million, or $14.40 a share, including a gain totaling $919 million mainly related to the sale of A&P Canada. A&P agreed in July to sell the operations to Montreal supermarket chain Metro for $1.4 billion in cash and stock. A year earlier, A&P reported a loss of $64.2 million, or $1.67 a share.

Excluding various gains and charges, A&P's earnings before interest, taxes, depreciation and amortization rose to $53 million from $48 million a year earlier.

The Montvale, N.J., operator of stores including Food Emporium and Super Fresh posted second-quarter sales of $2.17 billion, down from $2.49 billion a year earlier. Same-store sales dropped 1.1% from a year ago, excluding Hurricane Katrina-affected New Orleans stores.

A&P, which has been seeking to reduce its debt load and focus on stores in the Eastern U.S., said it has "substantially" improved its balance sheet, and a lower cost structure allows it to restore profitability to its business.

"We made major progress during the quarter in restructuring the company and forming the basis for a new and sustainable A&P," said Christian Haub, the company's executive chairman, in a statement. "Proceeds from the sale of A&P Canada completed during the quarter are being utilized to strengthen our balance sheet and improve our stores; and our investment position and relationship with Metro Inc. in Canada is generating income and other benefits that we believe have significant upside potential going forward."