CarMax Inc, the largest U.S. retailer of used cars, posted market-topping results for the seventh straight quarter as customers continued to shy away from splurging on new cars in a sluggish economy.

Shares of the company, which purchases, reconditions and sells used vehicles, rose 8 percent to $26.15 in morning trade on the New York Stock Exchange. They have risen 21 percent since the company reported solid first-quarter results in June.

CarMax, which benefited from the government's cash for clunkers program last year, said used cars sales rose about 11 percent in the second quarter to $1.89 billion.

Retailers of used cars like CarMax and its peer America's Car-Mart Inc are among the few that weathered the recession as cash-strapped consumers looked for bargain deals and postponed new car buys.

Same-store sales of used vehicles rose 4 percent, reflecting this trend as economic conditions continue to remain uncertain.

Encouraged by higher demand for used cars, the company said it plans to open five superstores in fiscal year 2012, adding to its existing store count of 103.

Given CarMax's ability to gain market share and grow its store base over time, we continue to believe that long-term investors could buy CarMax shares, RBC analyst Scot Ciccarelli said in a note to clients.

CarMax operates in a highly fragmented used-car market, which includes about 18,600 franchised automotive dealerships and 36,500 mon-and-pop and internet-based dealers.

The company, which began as a subsidiary of the now-bankrupt Circuit City Stores, however, said sales environment remains challenging.

Q2 BEATS

For the June-August period, the company reported net income of $107.9 million, or 48 cents a share, compared with $103.0 million, or 46 cents a share, a year ago.

Revenue jumped 13 percent to $2.34 billion.

CarMax's comparable store sales of used units rose 4 percent, while total sales of used units rose 5 percent for the quarter.

Analysts on average were expecting the company to earn 40 cents a share on revenue of $2.27 billion, according to Thomson Reuters I/B/E/S.

(Reporting by Fareha Khan in Bangalore; Editing by Vyas Mohan)