J.C. Penney ( JCP) reported a second-quarter loss that was narrower than analysts were expecting, and the retailer stuck with its forecast for the back half of the fiscal year.

The company reported a loss of 5 cents a share for quarter, compared with a loss of 23 cents in the year-earlier period. Analysts were expecting a loss of 10 cents.

J.C. Penney still expects third-quarter earnings of 15 cents to 20 cents a share and full-year profits of 90 cents to $1.

"We remain confident that the turnaround in Department Stores and Catalog is progressing and that the company's drugstore chain Eckerd will continue to achieve significant improvements in its business," Penney said in a press release.

Same-store department store sales fell 2.4% in the quarter. Eckerd's same-store sales rose 6.1%. Total sales for the quarter ticked down 0.2% to $7.198 billion from $7.211 billion.

Shares of J.C. Penney were lately down 30 cents, or 1.8%, to $16.45. The broader sector was higher, as the Dow Jones U.S. Retail Index climbed 2.8%.