Last week, J.C. Penney (JCPN.Q) announced another quarter of solid improvement in its struggling business. Same store sales rose 4.1% year over year and J.C. Penney's profit margin (excluding the impact of asset sales) improved significantly compared to the prior-year quarter.

J.C. Penney is certainly not out of the woods yet -- despite consistently posting same store sales growth since late 2013, it still has a heavy debt load and only expects breakeven free cash flow this year. Wall Street analysts don't expect the company to post an accounting profit until at least 2017. However, this is still a big improvement from the trajectory a couple of years ago, when bankruptcy seemed almost inevitable.

J.C. Penney released another solid quarterly earnings report last week. Photo: The Motley Fool

So how has J.C. Penney managed to pull off this remarkable turnaround? The return to same store sales growth has helped, but it hasn't been the most important factor. Cost-cutting has been the key to J.C. Penney's recent successes -- and will continue to be crucial going forward.

Cost-cutting began before the turnaround
J.C. Penney's cost-cutting began long before its recent turnaround efforts. In fact, it was a major part of ousted CEO Ron Johnson's failed strategy.

In early 2012, Johnson and his team outlined plans to cut costs by $900 million in two years as part of a move to everyday low pricing. They reasoned that running fewer promotions would simplify a lot of functions, allowing J.C. Penney to cut staff in its stores and home office. (For example, with fewer promotions, employees wouldn't need to change price stickers on an almost daily basis.) The strategy was also expected to help J.C. Penney economize on marketing costs.

Sure enough, J.C. Penney's selling, general, and administrative expenses (or SG&A) declined from $5.11 billion in the 2011 fiscal year to $4.51 billion in fiscal 2012 and $4.11 billion in fiscal 2013. This put the annual cost reduction at $1 billion by 2013, $100 million ahead of the original plan.

Adding back complexity without costs
In mid-2013 -- under new management -- J.C. Penney returned to its historical strategy of using relatively frequent promotions and coupons to drive store traffic and sales. But while Ron Johnson had blamed this pricing strategy as a cause of J.C. Penney's excessive costs, the retailer was able to bring back promotions without ramping up spending.

Promotions have returned at J.C. Penney. Photo: The Motley Fool

Instead, J.C. Penney cut its SG&A spending by another $121 million in fiscal 2014, reaching $3.99 billion. That trend has continued in 2015, with SG&A costs down 5.4% year over year through the first half of the fiscal year.

Considering that J.C. Penney has burned a lot of cash in the last few years -- and only expects to produce breakeven free cash flow in 2015 -- it's probably fair to say that J.C. Penney's successful cost-cutting has been the difference between survival and bankruptcy.

More room for improvement?
As good as J.C. Penney's cost performance has been in recent years, new CEO Marvin Ellison sees more room for improvement. Ellison told investors on the company's recent earnings call that there is still room to "root out bureaucracy" in order to reduce costs.

On a couple of occasions during the call, Ellison talked about the need to create a J.C. Penney that can thrive in today's marketplace -- not to resurrect the J.C. Penney of a decade ago that was a $20 billion retailer. With a significantly lower sales base today, J.C. Penney may be able to further reduce its cost structure while still allowing for future sales growth.

On the other hand, J.C. Penney could face cost pressure in the next few years from wage inflation. While the company doesn't pay anyone minimum wage today, some cities and states are moving their local minimum wages as high as $15 in the next few years. That could force it to raise wages significantly in some stores, offsetting other cost cuts.

J.C. Penney will never get back to its peak sales levels. However, with a market cap of about $2.5 billion today -- down from nearly $20 billion before the Great Recession -- it doesn't need to do that to produce good results for investors. There are still plenty of challenges ahead, but continued cost-cutting success could finally get J.C. Penney stock back on track.