Rite Aid ( RAD) bested Wall Street earnings estimates on Thursday, as the drugstore chain sharply cut its losses and boosted its revenue. The drugstore chain lost $16.4 million, or 5 cents a share, on $3.9 billion in revenue during its fiscal third quarter, which ended Nov. 30. During the same period last year, the company lost a whopping $112.8 million, or 23 cents a share, on $3.7 billion in sales. Wall Street analysts had expected Rite Aid to lose 9 cents per share in its third quarter this year. The company was largely able to cut its losses by increasing its take on its sales and decreasing its overhead. Rite Aid's gross profit margins, which measure the difference between a company's revenue and the cost of the products or services it sold, rose dramatically, from 21.9% of sales in the third quarter last year to 23.3% of sales in the just concluded quarter. That translated into $86.5 million more in gross profits in the third quarter this year compared with the year-ago quarter. At the same time, Rite Aid cut its sales, general and administrative costs from $848.6 million, or 22.7% of sales, to $832.6 million, or 21.5% of sales. "Our results highlight the substantial improvement we continue to make in Rite Aid's overall performance," said Mary Sammons, Rite Aid's president, in a statement. But the quarter wasn't a complete success for the company. Same-store sales in Rite Aid's third quarter grew by 6.7%, which was below the company' s previous guidance of 7% to 8%. Same-store sales compare results from outlets open more than one year. In a conference call with investors and analysts, Rite Aid executives blamed the same-store shortfall in part on a lack of new stores. Over the last two years, the company's store count has dropped from more than 3,700 to about 3,400. Sales at new stores tend to jump in their second and third years of operation, which boosts same-store sale figures, company officials argued.