NEW YORK ( TheStreet) -- Best Buy ( BBY) shares rose 12.4% in premarket trading Tuesday to $34.54 after the struggling retailer managed to post sharply better-than-anticipated earnings, led by strength in online sales.

Minneapolis-based Best Buy reported non-GAAP earnings of 32 cents a share on $9.3 billion in sales. Analysts were expecting earnings of 12 cents a share on sales of $9.13 billion.

Leading the strength was online sales, which had a comparable same-store-sales increase of 10.5%. Sales at Best Buy stores open a year a more fell 0.6%, but the real strength was in online sales, noted Hubert Joly, Best Buy's CEO.

Mobile phones and appliances were the stronger points of the quarter, while gaming and digital imaging continued to be particularly weak.

Also aiding the strength was a rise in the domestic gross profit rate. For the second quarter it came in at 27.4%, versus 24.3% in the year-ago quarter. Excluding legal settlements, non-GAAP domestic gross profit rate was 24.0%.

In a press release, Joly mentioned that Best Buy continues to work on improving comparable-store sales.

"In November at our investor meeting, we talked about the two problems we had to solve: declining comparable store sales and declining operating margins," Joly said. "Since that time, the resolution of these two problems has become our Renew Blue rallying cry and the organization's goals and objectives have been prioritized accordingly. While we are clear there is much more work ahead, we have made measurable progress since we unveiled Renew Blue last year, including near flat comparable store sales, substantive cost take outs, and better-than-expected earnings in the past three consecutive quarters."

During the quarter, Best Buy continued to strip out costs of its business, executing its Renew Blue cost reduction initiative. Best Buy eliminated $65 million in annual costs during the quarter, and has reduced costs by $390 million, leaving $335 million in costs to strip out of the North American business.

The company also raised money during the quarter, completing a $500 million bond offering for 5.0% notes due August 2018.

The company will host a conference call at 8 a.m. EDT to discuss the earnings..

-- Written by Chris Ciaccia in New York

>Contact by Email.