Barnes & Noble (NYSE:BKS) shocked the market today by posting a profitable second quarter. The business had been expected to continue its losing streak, but an increase in gross margin helped it bring in a profit, even as sales fell. The stock dropped in trading, though, as the third quarter is unlikely to have the same positive effects, while carrying over most of the negative ones. Here's what investors need to know and look out for in the future.

The Nook helped pull up gross margin
In the second quarter, the company's overall sales fell 8% compared to last year. That fall could have been horrible news -- it's still bad news -- for the business, but a few bright spots helped it through. The biggest surprise was that the Nook managed to increase its gross margin. The division also had a sales decrease, but lower costs and fewer markdowns helped it almost double its gross margin to 31%.

That cost success is just a part of solving the ongoing Nook problem. Now, management is heading into the third quarter focused on fixing the fall in digital content sales. That's where the Nook really shines, but as sales drop the division is simply going to flounder.

To get more devices in the hands of consumers, the company expects in the holiday season to see promotions back in rotation, which will impact gross margin. Luckily, the sales and administrative costs associated with the Nook are being well-managed, and that trend should continue.

Retail sales continue to struggle
While the Nook division found some hidden strengths, the company's retail segment proved itself less capable. Revenue and gross margin fell in the second quarter, and comparable sales excluding the Nook dropped 3.7% against 2012.

The company continues to make tough comparisons against last year's successful trilogies -- Fifty Shades of Grey and The Hunger Games. This year has proven to be less than stellar for core book sales, which is unfortunate as that is arguably the company's greatest asset. With Borders long gone, Amazon.comĀ focusing less on books and more on digital sales, and Books-A-Million running itself into the ground, the physical store could offer Barnes & Noble some solace. So far, no luck.

The future
The company's holiday quarter is unlikely to be anything more than boring. With comparable sales dropping, the company needs to get customers through the door just to get the brand back into an acceptable place. That's going to mean discounting, which is going to push margins down. The Nook also needs to get a move on if Barnes & Noble wants a post-Christmas digital sales bump -- again, bad news for margins.

It's not a total loss yet, though. The company is still the only game in town at its size, and that puts it in charge of its own destiny. Cost management remains key, and stopping the sales bleeding wouldn't be a bad thing. I still like Barnes & Noble -- I worked there and own a little stock -- but there's a still a long road to walk before this company is anything like a winner.

Fool contributor Andrew Marder has no position in any stocks mentioned. The Motley Fool recommends The Motley Fool owns shares of Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.