Stocks rebounded for the first time since Hurricane Rita became a tropical storm, buoyed by a less threatening weather forecast and a drop in oil prices.
Wal-Mart Stores, Lowe's and Bed Bath & Beyond led the turnaround on speculation that energy costs won't disrupt consumer spending.
The Standard & Poor's 500-stock index rose 4.42, or 0.4 percent, to 1214.62, recovering from a 2.2 percent tumble the previous three days and leaving it little changed for the year. The Dow Jones industrial average gained 44.02, or 0.4 percent, to 10,422.05. The Nasdaq composite index rose 4.14, or 0.2 percent, to 2110.78.
The three-day drop in the S&P 500 was its steepest in five months and came as Rita threatened oil refineries and communities along the Texas coastline, less than four weeks after Hurricane Katrina slammed into the Gulf Coast.
Benchmarks declined earlier in the day after Rita forced more than a million people to flee coastal cities including Corpus Christi, Tex., and oil prices climbed as much as 2 percent. The numbers rebounded as the hurricane weakened to a Category 4 storm, easing concern about refinery damage, and oil prices fell.
Wal-Mart, the world's largest merchant, gained 70 cents, to $43.19, as an index of retailing shares rallied 2.7 percent and contributed the most to the S&P 500's gain among 24 industry groups. Lowe's gained $2.87, to $65.30.
Bed Bath & Beyond rose $2.28, or 6.1 percent, to $39.70, for the best performance in the S&P 500. The No. 1 U.S. home-furnishings retailer announced earnings that exceeded analysts' estimates.
Caterpillar increased 89 cents, to $58, and was the second-biggest contributor to the Dow average's gain. Investors expect the world's largest maker of earthmoving equipment to benefit from construction and repairs after the hurricanes.
Sprint Nextel rallied 76 cents, to $24.31, and was the second-biggest contributor to the S&P 500's gain. The company raised the value of expected benefits from its merger by 20 percent, to $14.5 billion.
Chevron fell 50 cents, to $63.77, as a measure of energy producers slid with the price of crude, losing 0.5 percent. Marathon Oil dropped 35 cents, to $70.48.
New York Stock Exchange composite index rose 4.84, to 7519.86.
American Stock Exchange index fell 10.93, to 1720.50.
Russell 2000 index of smaller-company stocks rose 1.22, to 651.16.
NYSE: 2.42 billion shares, down from 2.55 billion on Wednesday. Decliners outpaced advancers 5 to 4.
Nasdaq: 1.72 billion shares, down from 1.8 billion. Decliners outnumbered advancers 10 to 9.
Crude oil for November delivery: $66.50, down 30 cents.
Gold for current delivery: $466.60 a troy ounce, down from $468.90 on Wednesday.