Blue-chip stocks fell on Tuesday as investors booked profits following a record reached in the previous session, but in the broader market, bank stocks and home builders gained as investors bet the worst of the credit squeeze may be over.

The flow of cash into equities slowed a day after the Dow rose to a record close, buoyed by hopes that Wall Street may have seen the worst of the credit squeeze after three big banks disclosed expected losses from the crisis.

A drop in oil prices dominated the session as the dollar strengthened, pressuring shares of energy companies such as Exxon Mobil Corp, which dropped 1.8 percent. The S&P energy index fell 1.3 percent.

Despite more weak data on the housing sector, optimism that banks are working out losses from the credit market's turmoil drove banking stocks higher, while home builders' shares extended gains from the previous session that followed an upgrade from Citigroup.

We had this massive move up in the market yesterday, so it's only natural that there be some profit-taking, said Stephen Massocca, co-chief executive of San Francisco-based investment bank Pacific Growth Equities.

The market, by and large, thinks that banks have taken their medicine, they've recognized their problems and are dealing with them.

The Dow Jones industrial average was down 40.24 points, or 0.29 percent, to end at 14,047.31. The Standard & Poor's 500 Index was down 0.41 of a point, or 0.03 percent, at 1,546.63. But the Nasdaq Composite Index was up 6.12 points, or 0.22 percent, to close at 2,747.11.

Shares of Exxon Mobil fell 1.8 percent to $92.24 on the New York Stock Exchange, while shares of rival Chevron Corp. dropped 2 percent to $92.56. U.S. crude for November delivery slipped 19 cents to settle at $80.05 a barrel on the New York Mercantile Exchange.

Big manufacturers such as United Technologies Corp also bore the brunt of the profit-taking, a day after their climb helped propel the Dow to its 33rd record-high finish for 2007.

Shares of United Technologies, a diversified manufacturer, ended down 1.8 percent at $80.62 on the NYSE.

But shares of Bank of America rose 2.1 percent to $51.72 on the NYSE. The Dow Jones U.S. home construction index gained 5.5 percent, its biggest one-day advance in two weeks.

Encouraging news in the auto sector also helped cushion the broader market as General Motors Corp posted a rise in September sales. GM shares ended up 2.8 percent at $37.05. The automaker was the Dow's top advancer.

Among home builders, shares of Toll Brothers Inc jumped 7.6 percent to close at $22.22, while Beazer Homes shares climbed 12.4 percent to $9.44.

On the Nasdaq, major decliners were led by Garmin Ltd, the world's largest maker of navigation devices, which fell for a second day following Nokia's offer to buy Garmin's rival, Navteq. Garmin's stock slid 6.7 percent to $100.10.

Palm Inc, maker of the Treo smart phone, fell 3.4 percent to $15.45 after it warned on Monday that profit would lag Wall Street's estimates. Also declining was rival Research In Motion, which lost 2.4 percent to $96.26.

Technology shares have been at the forefront of the market's recent recovery on the belief that the Federal Reserve could cut interest rates further, boosting the outlook for business spending on technology.