Same-store sales rose 3.9 percent in the last two months of the year due to higher online sales and strong demand for the company's private-label offerings and gift products, J.C. Penney said on Thursday.

The company's strong performance came despite unusually warm weather during the year's winter months, which hurt sales of apparel such as sweaters, coats and gloves.

It was also in stark contrast to rival Macy's Inc, which on Wednesday said 80 percent of its 4.7 percent drop in same-store sales was due to the warmer-than-usual winter.

Investors, however, pushed shares of Macy's higher on Thursday after the company also said it would cut thousands of jobs and shut stores in a bid to boost profits.

Several apparel retailers, including Victoria's Secret owner L Brands Inc and sportswear maker Zumiez Inc, also reported on Thursday better-than-expected comparable sales.

The results cheered investors of consumer discretionary stocks on a day market volatility in China and a relentless slide in oil prices sparked a selloff in global markets.

J.C. Penney's shares rose 4 percent to $7.28 in afternoon trading, while Kohl's Corp was up 2.4 percent at $51.29. Stocks of big box retailers Wal-Mart Stores Inc, Target Corp were also up more than a percent.

"Despite unprecedented warm weather that significantly affected apparel sales across the company, our focus on private brands, enhanced omnichannel execution and compelling gift giving selection resulted in strong holiday sales," J.C. Penney Chief Executive Marvin Ellison said in a statement.

Ellison also attributed the strong sales to its online business, which posted record sales during the holiday season.

J.C. Penney also reaffirmed its full-year adjusted earnings target of $645 million before taxes and the company said it planned to generate positive free cash flow in fiscal 2015.

Up to Wednesday's close of $7.00, J.C. Penney's shares had risen 7 percent in 12 months, compared with a nearly 1 percent drop in the S&P 500 index.

(Reporting by Siddharth Cavale in Bengaluru; Editing by Kirti Pandey, Saumyadeb Chakrabarty and Maju Samuel)

Stocks treated in this article : Macy's, Inc., J C Penney Company Inc