Stocks ended mostly flat Friday as investors chose to remain cautius before next week's presidential election and digested a slower-than-expected third-quarter gross domestic product report along with a disappointing drop in consumer confidence.

The Dow Jones industrial average (searchended up 22.93 points, or 0.23 percent, at 10,027.47, based on the latest data. The Standard & Poor's 500 Index (searchrose 2.76 points, or 0.24 percent, to 1,130.20. But the technology-laced Nasdaq Composite Index (searchdipped 0.75 of a point, or 0.04 percent, to close at 1,974.99.

Relief from rising oil prices this week helped stocks regain much of the ground lost earlier in the month, with the Dow posting back-to-back triple-digit gains on Tuesday and Wednesday, the first time since May 2003 that the blue chips accomplished such a feat. For the week, the Dow rose 2.76 percent, the Nasdaq climbed 3.13 percent and the S&P 500 added 3.14 percent.

Stocks finished the month surprisingly strong. As crude oil futures rose throughout October, stocks fell precipitously, setting new year-to-date lows on the Dow. Only this week's gains salvaged the month's trading — for the month, the S&P 500 added 1.4 percent and the Nasdaq surged 4.12 percent, while the Dow lost 0.52 percent.

"We're in the calm before the storm -- the storm being the election. We're looking at oil and we're following the polls." said Chip Dickson, chief U.S. investment strategist at Lehman Brothers.

Third-quarter GDP rose by 3.7 percent, according to the Commerce Department (search), less than the 4.3 percent rise Wall Street expected. However, the figure was stronger than the 3.3 percent growth in the second quarter.

"It's not bad in a historical context, but for us to generate any meaningful job growth, we're going to have to do better than that," said Daniel Portanova, managing director at Gartmore Separate Accounts in Irivington, N.Y. "This isn't enough to really do much for the equity markets."

The GDP report was one of the final pieces of economic data before Tuesday's U.S. presidential election in which the economy's condition has been a focal point.

Meanwhile, U.S. consumer sentiment deteriorated in October as rising energy costs and persistent job worries made Americans less optimistic about the future, according to the University of Michigan (search). It said its consumer confidence index dropped to 91.7 in October, down from 94.2 in September but higher than a mid-month reading of 87.5.

"Confidence is down a little bit, it seems to be driven by concerns about oil and about the future," said Steve Gallagher, economist at SG Cowen Securities.

Stocks had risen three days in a row despite looming uncertainty about next week's election. A Reuters/Zogby poll Friday showed President Bush and Democratic Sen. John Kerry in a dead heat.

Soaring oil prices in the third quarter were partly to blame for the slower-than-expected growth, analysts said. As oil climbed through the $55 per barrel mark in October, investors feared a further slowdown for the fourth quarter as well. A barrel of light crude was quoted at $51.76, up 84 cents, on the New York Mercantile Exchange (search).

Even as oil prices stabilized at $51 to $52 per barrel, many investors still remained on the sidelines as the elections loomed closer, waiting to see whether a candidate would emerge as the front-runner over the weekend or whether another contested election, like 2000, was in the offing.

"Oil's up, we had some economic numbers that were not great, and we're still seeing the market hanging in there," said Todd Leone, managing director of equity trading at SG Cowen Securities. "You'll probably see some people try to make a few bets between now and Tuesday, but there's a lot of people just waiting to see what happens."

Rising oil helped ChevronTexaco Corp. (CVX) to a 60 percent rise in third-quarter profits, though part of the gains came from one-time sales of non-strategic assets. With that gain aside, however, the nation's second largest oil company, missed Wall Street profit forecasts by 3 cents per share. ChevronTexaco climbed 59 cents to $53.06.

Investigations of the insurance industry continued, with Connecticut's attorney general subpoenaing Allstate Corp. (ALL) in its probe of bid-rigging and price fixing throughout the industry. Allstate fell 18 cents to $47.52, while previous investigation targets Marsh & McLellan Cos. Inc. (MMC) was down 56 cents at $27.66 and American International Group Inc. (AIG) dropped 50 cents to $60.71.

Avon Products Inc. (AVP) weighed on the S&P 500 index, slipping 8.5 percent, or $3.66, to $39.55 after Deutsche Bank Securities lowered its rating on the direct seller of cosmetics to "hold" from "buy".

Halliburton Co. (HAL) gained 79 cents to $37.04 despite an Associated Press report that the FBI has launched a probe into whether the U.S. government improperly awarded no-bid contracts to the company for services in Iraq.

The U.S. Food and Drug Administration said Merck & Co.'s (MRK) new pain reliever Arcoxia, was "approvable" pending further review of clinical data. Arcoxia, which Merck hopes will replace the discredited Vioxx arthritis drug, was not expected to be approved. Merck lost 26 cents to $31.31.

Merck rival Bristol Myers-Squibb Co. (BMY) slipped 58 cents to $23.43 after the drug maker reported a 16 percent drop in profits for the third quarter. The company's results were in line with Wall Street expectations.

The Russell 2000 index of smaller companies was down 1.84, or 0.31 percent, at 583.79.

Overseas, Japan's Nikkei stock average fell 0.75 percent. In Europe, Britain's FTSE 100 closed down 0.4 percent, France's CAC-40 dropped 0.4 percent for the session, and Germany's DAX index rose 0.02 percent.

Reuters and the Associated Press contributed to this report.