U.S. discount retailers, led by Wal-Mart (WMT), posted modest sales gains in July, but electronics stores weathered declines as consumers pulled back on spending in the face of the prolonged stock market slump.

For most retailers, tighter control over inventories led to fewer clearance sales and better profit margins in July. But that also made for less overall merchandise sold.

July is typically a transitional month before the back-to-school selling starts in earnest, and industry watchers tend to put more weight in August sales.

"July sales are soft and we relate this to the fact that there is very little hiring going on," said Kurt Barnard, publisher of Barnard's Retail Trend Report. "People will buy what they need, not what they want."

Best Buy Co. Inc. (BBY), the No. 1 U.S. consumer electronics retailer, Thursday slashed its quarterly profit outlook for the second time in two months, citing lower spending and an uncertain economy. Its stock plunged 38 percent, down $11.80 to $19 on the New York Stock Exchange.

The Bank of Tokyo-Mitsubishi Ltd. said same store sales rose 2.6 percent in July. It had forecast a rise of 3 percent, compared with a 5.1 percent gain in June.

Discounters again were the strong segment as the sagging economy pushed penny-pinching customers to lower-priced and more "necessary" merchandise.

Wal-Mart Stores Inc., the world's No. 1 retailer, said July sales rose 4.5 percent, slightly under its guidance of same store sales in a 5 percent to 7 percent growth range. But it said second-quarter earnings should meet or "possibly exceed" its previous earnings guidance of 44 to 45 cents per share for the second quarter.

Minneapolis-based Target Corp. (TGT), another traditionally strong discounter, posted an overall increase of 1 percent in same-store sales. Target said it expects "very strong earnings growth" for the second quarter.

Value-priced retailer Kohl's Corp. (KSS) reported a same-store sales increase of 7.5 percent.

Ross Stores said July same-store sales rose 4 percent but would have hit its 5 percent goal if not for the changing of a Florida tax holiday.

Off-price retailer TJX Cos, which reported a rare decline of 1 percent in July sales, and said the decline was due to having less summer inventory to clear than in prior July periods.

"A lot of apparel retailers have brought their inventories down, so they're going into the second half with very lean inventory -- very little downward pressure on the prices," said Frank Badillo, senior economist with consultants Retail Forward. "That puts them in good position to keep margins up and that's where some of the optimism comes from."

Gap Inc. (GPS), the clothing giant that runs Gap, Old Navy and Banana Republic stores, reported a July same-store sales decrease of 8 percent and predicted second-quarter earnings of 4 to 5 cents per share, slightly above Thomson First Call's 3 cents per share view. San Francisco-based Gap also said it named former Banana Republic President Gary Muto as the president of Gap U.S.

Women's apparel chain AnnTaylor Stores (ANN) posted a rise of 7.4 percent in July sales and raised its second- and third-quarter guidance. Talbots Inc.'s also upped its second-quarter view, but its July sales slid 19 percent.

The battered department store sector was under pressure as competition with discounters and specialty retailers remained intense.

Federated Department Stores Inc. (FD), which runs Macy's and Bloomingdale's, reported July sales were down 5.2 percent but said it expected to meet the high end of its second-quarter 50 to 60 cents per share earnings estimate.

Sears Roebuck and Co., Saks Holdings Inc. and May Department Stores all posted same-store sales declines for the month.

Neiman Marcus Group also reported a same-store sales decline for July but predicted better-than-expected fourth-quarter earnings of 5 to 10 cents per share.