Rite Aid (RAD 10.19%) will release its quarterly report on Thursday, and investors who bucked the popular consensus that the drugstore chain was doomed to failure have reaped the rewards this year, with shares rising nearly sixfold from this time a year ago. But the question remains whether Rite Aid can truly pose a long-term challenge to CVS Caremark (CVS -0.10%) and Walgreen (WBA 1.45%), especially with the extensive debt that Rite Aid still has to address.

Rite Aid has labored in the shadow of Walgreen and CVS for a long time, as its larger competitors have been better able to grow and boost their profitability because of their healthier balance sheets. Yet throughout 2013, Rite Aid has defied skeptics, making smart debt-refinancing moves and putting itself in position to earn what could become a sustainable profit going forward. But can the good times last, and if so, will Rite Aid ever grow large enough to mount a serious threat to Walgreen and CVS? Let's take an early look at what's been happening with Rite Aid over the past quarter and what we're likely to see in its report.

Stats on Rite Aid

Analyst EPS Estimate

$0.04

Change From Year-Ago EPS

(43%)

Revenue Estimate

$6.32 billion

Change From Year-Ago Revenue

1.3%

Earnings Beats in Past 4 Quarters

3

Source: Yahoo! Finance.

Will Rite Aid earnings stay in the black this quarter?
In recent months, analysts have gotten increasingly optimistic about Rite Aid earnings, boosting November-quarter estimates by a penny per share and adding about a dime per share to their full-year fiscal 2014 and 2015 projections. The stock has kept charging higher, rising another 62% since mid-September.

Rite Aid kept its positive momentum into the beginning of the quarter, once again surprising investors by posting a profit in its August quarter. In particular, Rite Aid managed to boost its gross margins yet again during the quarter, this time by 1.4 percentage points to 28.9% as its cost of goods sold declined substantially. Even though Walgreen used discounting to try to bolster its own sales during the quarter, Rite Aid didn't allow its competitor's move to affect its own discipline. Moreover, Rite Aid's results were actually worse than they would have been but for a charge it took in order to refinance its debt at much more favorable interest rates. A boost to full-year earnings guidance helped send the stock up 23% in a single day.

Rite Aid has benefited from the same macroeconomic factors that have helped CVS and Walgreen bolster their own growth recently. On one hand, a big move toward generic drugs after the extensive patent expirations in the past several years has helped Rite Aid cut its wholesale drug costs, helping to boost margins. At the same time, the advent of the Affordable Care Act has given drugstore chains a useful opportunity to set up in-store local health-care clinics, essentially fighting with doctors' offices to handle a hoped-for influx of new patients when they get insurance coverage.

Another benefit for Rite Aid has been its loyalty program, which has encouraged repeat business. Such programs have helped drugstore chains and other retailers retain customers, and that's exceedingly important in the prescription segment, where having customers flee to other stores can be extremely costly. Walgreen found that out during its dispute with pharmacy benefits manager Express Scripts, and getting its former customers back from Rite Aid and CVS after the debacle proved to be a lengthy process.

In the Rite Aid earnings report, watch to see whether the drugstore retailer is able to keep its margins moving in the right direction. With much further to go before it can get in the same league as CVS and Walgreen financially, Rite Aid could give shareholders more gains if it can continue to execute well and improve its balance sheet slowly but surely.

Click here to add Rite Aid to My Watchlist, which can find all of our Foolish analysis on it and all your other stocks.