J.C. Penney (JCP) booked a smaller-than-expected loss and better sales in the first quarter, as the struggling retailer gains traction in its turnaround efforts.

The company said it lost $352 million compared to $348 million in the year-ago period. On a per-share basis, the loss narrowed to $1.15 from $1.58, given fewer shares outstanding.

J.C. Penney’s adjusted loss checked in at $1.16 a share versus $1.31. Sales rose 6.3% to $2.8 billion.

Wall Street analysts were looking for a per-share loss of $1.25 and sales of $2.71 billion.

The company also announced it obtained a new credit facility of $2.35 billion, replacing a $1.85 billion bank line.

Shares rallied 15.2% in after-hours trading on Thursday. The stock is down 8.5% year-to-date.

J.C. Penney is in the midst of another overhaul after a failed turnaround plan led by former chief executive Ron Johnson. The former Apple executive eliminated discounts and some popular house brands at J.C. Penney stores, fueling the company’s descent.

Mike Ullman returned as CEO in April 2013 and began to reverse those decisions. In Thursday’s earnings report, Ullman said J.C. Penney is building momentum as it seeks a return to profitability.

“It is clear that our efforts to re-merchandise many areas of the store and revamp our messaging to the customer are taking hold,” Ullman said. “Despite a difficult retail environment, our strong performance during the Easter holiday period and other key promotional events enabled us to deliver better than anticipated sales results.”

The Plano, Texas-based department-store chain expects second-quarter and 2014 comparable sales to increase in the mid-single digits. J.C. Penney also said full-year gross margins should improve significantly versus 2013, while free cash flow should be flat.

In the latest period, gross margin widened to 33.1% from 30.8% last year.

Online sales jumped 25.7% year-over-year. Total same-store sales rose 7.4% using a new calculation method that excludes certain items like liquidation sales. Under the old method, comparable sales were up 6.2%.

J.C. Penney said jewelry, women’s apparel and men’s apparel were among the top performing divisions in the first quarter.

Follow Matthew Rocco on Twitter @MatthewRocco