For the past year or so, J.C. Penney (NYSE: JCP) has been a quiet success story.

After the failed transformation implemented by former CEO Ron Johnson  appeared in danger of putting the retailer out of business, it has slowly rebuilt itself. The road has not been without bumps, and problems remain, but while rival Sears (NASDAQ: SHLD) teeters on the edge of disaster, J.C. Penney has pulled itself back from the brink.

In some ways, it's hard to pinpoint what Sears has done wrong and J.C. Penney has done right. Both companies offer similar merchandise, and J.C. Penney even brought appliances back to its stores after a 33-year hiatus.

The biggest change, however, may be that J.C. Penney has been able to reach an audience that Sears has courted -- millennial moms. 

What is J.C. Penney doing right?

Sears specifically attempted to lure millennials by carrying a line of clothes from the Kardashian sisters. That might have been too blunt an attempt for a generation that has been resistant to blatant pandering.

Instead of going after millennials as a whole, J.C. Penney has instead focused on a subset of the group: millennial moms.

The company told CNBC that this emerging (and growing) group, now accounts for 45% of its revenue. That's a stunning, but encouraging, amount when you consider that the number of millennial moms is only going to grow in coming years.

"We want to be able to deliver her needs both as a woman and as a mother," Sheeba Philip, vice president of marketing strategy and communications, told CNBC. "That's a huge unmet need."

To keep up its momentum, the retailer has been tweaking its merchandise to better serve this group. For the holidays, that has meant bringing a dedicated toy section back to its kids department. Going forward, it's a matter of meeting the fashion and beauty needs of these young moms by keeping up with the trends.

Is J.C. Penney saved?

The biggest problem for Sears may be that it no longer has a core customer. The brand has lost its identity, and that makes it hard for it to market itself.

For J.C. Penney, having a single group account for 45% of its sales makes it easier to focus its merchandise and marketing. And given that millennial moms are are relatively young, the company can work on meeting the evolving needs of that group as it ages, while serving the next set of mothers and children.

10 stocks we like better than J.C. Penney
When investing geniuses David and Tom Gardner have a stock tip, it can pay to listen. After all, the newsletter they have run for over a decade, Motley Fool Stock Advisor, has tripled the market.*

David and Tom just revealed what they believe are the 10 best stocks for investors to buy right now... and J.C. Penney wasn't one of them! That's right -- they think these 10 stocks are even better buys.

Click here to learn about these picks!

*Stock Advisor returns as of Nov. 7, 2016

Daniel Kline has no position in any stocks mentioned.

Want to learn how to invest?

Get a free 10 week email series that will teach you how to start investing.

Delivered twice a week, straight to your inbox.