Drugstore chain Rite Aid (RAD 5.96%) gave shareholders extremely impressive returns in 2013, with the stock climbing 318% since January. Despite strong competition from Walgreen (WBA -0.30%) and CVS Caremark (CVS -0.55%), Rite Aid now trades at its highest level since 2007. Let's take a closer look at the company to discover why the stock climbed so high and whether Rite Aid looks poised to continue gaining ground in 2014 and beyond.

What pushed Rite Aid higher
Rite Aid's gains have largely come from one thing: The drugstore chain managed to avoid the all-out collapse that many investors have expected for years. Prior to the stock's strong performance in 2013, Rite Aid shares were stuck in the $1-$2 range for years following the financial crisis, failing to participate in the bull market that lifted rivals CVS and Walgreen to better performance between mid-2009 and the beginning of 2013.

But things started going right for Rite Aid this year. After posting its first annual profit in seven years during fiscal 2013, Rite Aid has continued to remain profitable, reporting positive earnings for the fourth consecutive quarter in its report for the three-month period ended in August. That report defied investor expectations for a quarterly loss, with Rite Aid pointing to the introduction of more generic drugs as well as cost-cutting on general and administrative expenses as helping it keep margins up. A 1.7% increase in same-store pharmacy sales points to the renewed strength the business has seen, and the company gave positive guidance for the remainder of its current fiscal year.

RAD Total Return Price Chart

Rite Aid Total Return Price data by YCharts.

So far, bearish predictions that Rite Aid would have to give up its impressive gains haven't panned out. The initial fear was that Rite Aid's success had stemmed from Walgreen's dispute with pharmacy benefits manager Express Scripts, which had led many Walgreen customers to defect to its competitors. Once Walgreen resolved that dispute, it sought to get those customers back from CVS and Rite Aid. But even though same-store sales results reflected some of Walgreen's efforts early in the year, they haven't kept Rite Aid from making money.

Stats on Rite Aid

Revenue, Past 12 Months

$25.26 billion

1-Year Revenue Growth

(3.4%)

Net Income, Past 12 Months

$307.45 million

Year-Ago Net Income

($280.09 million)

Source: S&P Capital IQ.

Can Rite Aid still climb from here?
The big question for Rite Aid investors is whether the stock has more room to run. Rite Aid still has lower profit margins than CVS and Walgreen, reflecting the headwinds it faces in trying to bolster sales while increasing the financial efficiency of its operations. That's reflected in its stock price, though, with multiples based on sales and operating cash flow much lower than its two rivals.

One potential source of new revenue could come from the Affordable Care Act, as Rite Aid aims to provide more services under Obamacare to lure shoppers into its stores. Yet Walgreen and CVS both have similar initiatives, and their much-larger market shares could be an advantage in bringing new customers through their doors.

Rite Aid's 2013 was spectacular, and it will be nearly impossible to duplicate a 318% gain in 2014. But many shareholders will consider it a win even if Rite Aid only manages to maintain its share-price gains next year, especially if the drugstore chain can keep making money in a competitive environment in which CVS and Walgreen pose an ever-stronger threat.

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