With the Eckerd drugstore anchor finally cut loose, it looks like smooth sailing ahead for retailer J.C. Penney (NYSE:JCP). Fellow Fool Alyce Lomax reported last month that a brisk tailwind had already begun to form, when same-store sales increased 4.8%, even as competitors such as Wal-Mart (NYSE:WMT) and Target (NYSE:TGT) were stuck in the doldrums. A few weeks later, management raised its outlook for the second time in less than a month, forecasting second-quarter earnings of $0.21-$0.23 per share, more than double previous guidance of only $0.09.

The company's crystal ball proved fairly accurate, as earnings from continuing operations released this morning hit the high end of that range, $0.23 per share, or $72 million, versus a prior-year loss of $3 million. This excludes a $71 million loss from discontinued operations associated with the sale of Eckerd. Revenues rose 5.8% to $3.86 billion on same-store sales that accelerated to finish 7.1% higher for the quarter. These numbers stand in stark contrast to rival Sears (NYSE:S), whose second-quarter revenues, earnings, and comps plunged 14%, 83%, and 2.9%, respectively.

The cost-cutting measures that translated to higher earnings last quarter again yielded substantial bottom-line rewards. Operating margins jumped to 4.0% from 1.4%, gross margins expanded 150 basis points to 37.4%, and SG&A expenses were shaved by more than a full point. These improvements helped operating profits triple from $53 million to $156 million. The only real weakness came from catalog sales, as catalog/Internet combined fell 1.6%, but Internet sales alone surged 30% higher.

Not only have J.C. Penney's operations rebounded, but also the company's balance sheet has strengthened considerably. Proceeds from the sale of Eckerds will help eliminate $2.3 billion in debt, and another $3.4 billion in lease obligations will be wiped clean.

Furthermore, the company plans to redeem all of its outstanding preferred stock, which will cut dividend payments by $11 million annually, convert $650 million of convertible securities into common stock, and repurchase up to 75 million shares. As a result, the net diluted shares outstanding will be reduced by 21% to 250 million. The changes in capital structure have prompted ratings agency Fitch to raise its ratings on J.C. Penney's $5.2 billion debt and give the company a positive credit outlook.

Even though shares recently hit multiyear highs, the stock is still trading at only around 13.5 times forward earnings. The valuation seems fair, if not compelling, for a company with sustained same-store sales growth, significant margin expansion, a vastly improved balance sheet, a strong earnings outlook, and an upbeat start to the third quarter.

Fool contributor Nathan Slaughter owns none of the companies mentioned.