Stock markets have performed well over the past few months, but Wall Street wasn't able to keep the upward momentum going this week. On Friday morning, major market benchmarks opened lower, with small-cap indexes seeing declines of as much as 1.5%.

However, some individual stocks managed to post gains despite the falling market. CarMax (KMX -0.73%) got an early start on earnings season, releasing quarterly financial results that made shareholders more confident in the car dealer's future. Meanwhile, GSK (GSK -0.58%) saw its stock rise on a potential settlement in a long-standing case with big implications for the company. Read on to learn more about both companies.

CarMax gets the green light

Shares of CarMax rose 7% early Friday. The car dealer reported fiscal first-quarter financial results for the period ended May 31 that reflected the tough economy but suggested the potential for better times ahead.

CarMax's financial results weren't pretty. Net revenue plunged 17% year over year to $7.7 billion. Retail used vehicle unit sales were down almost 10% from year-ago levels, while wholesale unit volume dropped nearly 14%. Margin per vehicle remained relatively steady, though, and substantial cost-cutting measures limited the damage to CarMax's bottom line. Earnings of $1.44 per share were down just $0.12 from year-ago levels, although the current-year period benefited from a favorable legal settlement.

Despite the tough comparisons to the previous year's quarter, CarMax highlighted the fact that the most recent results showed improvement from three months ago. CEO Bill Nash pointed to ongoing efforts to boost operating efficiency and improve customer experience as key priorities, and the chief executive believes that CarMax's work in those areas should help it both now and when more favorable conditions for growth come in the future.

Used vehicle prices have been volatile, but recent declines presented CarMax and its peers with some inventory management challenges. Investors expected that CarMax's results would be far worse than they actually were, and that has produced a glimmer of hope that the worst could be over for the used car retailer.

GSK reaches a settlement

Shares of GSK climbed 4% early Friday. Investors reacted favorably to news of a legal settlement in a high-profile case involving the pharmaceutical stock.

GSK announced that it had settled a lawsuit filed by a California resident who alleged that his bladder cancer was a result of taking the heartburn drug Zantac. The suit was scheduled for trial beginning in late July, and it would have been the first Zantac case to go before a jury. In particular, some investors were pleased to see a case that would have been heard in a California court not go forward, as much of the litigation concerning Zantac will go before courts in Delaware, a state seen as friendlier to large corporations.

Thousands of cases remain outstanding in state courts, but GSK and its peers won a big victory late last year when a federal court in Florida granted summary judgment in favor of the defendants in December. That ruling hinged on plaintiff expert testimony that the court found unreliable.

It's still unclear how much potential liability GSK and other drugmakers could have in Zantac-related cases. Yet at least for now, GSK won't have to worry about a high-profile jury award that could sway popular opinion against the pharmaceutical company.