Barnes & Noble (BKS) disclosed a lighter-than-expected fiscal first-quarter loss on Tuesday as the largest U.S. bookstore chain continues to benefit from healthy digital sales.

Shares of New York-based Barnes & Noble leaped almost 5% on the heels of the earnings beat, putting them on pace to trim their 2012 losses of around 12%.

The company said it lost $41 million, or 78 cents a share, last quarter, compared with a deeper loss of $56.6 million, or 99 cents a share, a year earlier. Analysts feared a deeper loss of 98 cents a share.

Revenue rose 2.5% to $1.5 billion, narrowly topping the Street’s view of $1.48 billion.

Barnes & Noble’s revenue was bolstered by a 46% year-over-year surge in digital content sales as well as a 4.6% rise in bookstore same-store sales.

However, Nook sales, which include the e-readers, digital content and accessories, were flat at $192 million due to lower average selling prices and production issues surrounding the   company’s Glowlight product.

Barnes & Noble also reported a 2% decline in comparable college store sales from the same period a year earlier.

“The growth in comps at retail and the continued strong growth of our digital content business, as well as increased cost management focus, were drivers in the business turning from an EBITDA loss last year to slightly positive EBITDA in the first quarter of this year,” CEO William Lynch said in a statement.

Barnes & Noble said it expects its alliance with software behemoth Microsoft (MSFT) that was unveiled in April to close in the fall. The two companies are forming a new subsidiary that will house the Nook and college businesses after a $300 million investment from Microsoft.

Wall Street cheered the better-than-expected results from Barnes & Noble, boosting its shares 4.45% to $12.90 ahead of the opening bell.

Follow Matt Egan on Twitter @MattMEgan5