Consumers continue to spend, at least at the drugstore.

The nation's largest drugstore chains have reported solid July sales numbers, in sharp contrast to other recent data such as earnings warnings from apparel companies and flagging consumer confidence that suggest consumers may finally be tapped out.

On Tuesday, CVS ( CVS) and Rite Aid ( RAD), the nation's second- and third-largest drugstore chains, reported hefty gains in same-store sales numbers for July, igniting a mild rally in their shares.

CVS said that same-store sales, which measure activity in shops open at least a year, rose 9% in July, while Rite Aid said its comparable store sales rose 7.4%. On Friday, Walgreen ( WAG), the nation's largest drugstore chain, reported an 11% gain in same-store sales.

In early trading Tuesday, Rite Aid was up 6 cents, or 3%, at $2.07; CVS gained $1.16, or 4.4%, to trade at $27.61; and Walgreen was up 88 cents at $33.50.

The news from the drugstore chains was much brighter than other recent retail indicators. A number of earnings warnings lately, from apparel chains Hot Topic ( HOTT), Wet Seal ( WTSLA)and Children's Place ( PLCE), have hammered the sector, just as most major retailers prepare to report July sales on Thursday. At the same time, the latest consumer confidence figures showed a decline of 9 points in July compared with June, fanning fears that the consumer's resilience, which has helped to keep the economy afloat as business investment tanked, may be waning.

Still, even drugstore stocks -- long thought to be recession-proof -- have not held up well during the downturn. All three of the largest chains have had their own problems. Rite Aid stock has lost more than half its value this year as investors became leery of the company's turnaround hopes. The company was forced to restate earnings in 2000 after a wide-ranging accounting probe, and earlier this year it reported that its losses were larger than anticipated.

Meanwhile, CVS and Walgreen shares are off slightly on the year -- a better performance than the major averages, but investors have lost money nonetheless. CVS has been hampered by a pharmacy shortage, while investors have come to worry about Walgreen's pricey valuation and stepped-up competition from mass merchandisers.