More Videos:

J.C. Penney Is Surging Because of This One Key Figure

Tickers in this article: JCP

This story has been updated from 4:12 pm ET with additional information.

NEW YORK ( TheStreet) - J.C. Penney shares were surging 23.4% to $10.33 in after-hours trading as the struggling department store delivered first-quarter earnings results that were above Wall Street's expectations, and same store sales surged past expectations.

J.C. Penney's comparable store sales came in at 6.2% above consensus expectations of 4% growth for the quarter, according to Thomson Reuters.

Before getting too excited, the Plano, Texas-based company still reported a loss for the quarter. J.C. Penney had a quarterly net loss of $352 million, or $1.15 a share. But it was better than the EPS loss it took in the first quarter of 2013 of $348 million, or $1.58 a share. Net sales rose 6.3% to $2.801 billion for the quarter.

Analysts expected a loss of $1.25 a share. Revenue growth was expected to rise a mere 3% to $2.707 billion, according to Thomson Reuters .

J.C. Penney's gross margin improved 230 basis points compared to the prior year's quarter to33.1 % of sales, compared to 30.8 % in the same quarter last year. That said, gross margin was still hurt by the continued clearance sales of to get rid of discontinued merchandise.

WATCH: More market update videos on TheStreet TV | More videos from Kori Hale

Additionally J.C. Penney announced a new credit facility that it says will further strengthen its position.The company said it has obtained a "fully committed and underwritten" $2.35 billion senior secured asset-based lending (ABL) credit facility to replace its existing $1.85 billion ABL bank line, which matures in April 2016.

"Due to favorable market conditions, the company decided to pursue this new facility proactively to extend the maturity several years and enhance its liquidity position. This financing is expected to provide better pricing terms and is expected to add $500 million of incremental liquidity during peak seasonal needs. The company expects to close the facility during the second quarter," according to the earnings release.

The retailer said during its first-quarter earnings call that it planned to be completed with the turnaround by the end of 2014.

"We are very pleased to report that JCPenney delivered its second consecutive quarter of comparable store sales growth, as well as continued gross margin improvement," CEO Myron E. (Mike) Ullman said in the statement. "It is clear that our efforts to re-merchandise many areas of the store and revamp our messaging to the customer are taking hold. 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. We expect to carry this momentum into the second quarter as we continue to position the company for long-term profitable growth."