A late-day buying rush rescued Wall Street from a losing session Wednesday, overcoming rising oil prices and disappointing economic news that had kept the major indexes in negative range for most of the session. Blue-chip stocks closed higher, but tech stocks lagged.

The final hour advance came after oil futures topped $43 a barrel, a 21-year high, raising inflation worries among investors already nervous about slower growth in the second half of the year. Some analysts doubted the rally's conviction, however.

"The valuations on the Standard & Poor's 500 are at a level we haven't seen since 1995, which is pretty impressive if you're out there shopping for stocks," said Thomas F. Lydon Jr., president of Global Trends Investments in Newport Beach, Calif. "However, the average investor doesn't have the confidence to do real buying in this market. It was nice to see the reversal . . . but the fundamentals still tend to be on the negative side."

The Dow Jones industrial average rose 31.93, or 0.3 percent, to 10,117.07. The Nasdaq composite index fell 10.84, or 0.6 percent, to 1858.26. The Standard & Poor's 500-stock index gained 0.59, to 1095.42.

Among the day's best advancers, Boeing gained 79 cents, to $49.01, after reporting better-than-expected profit and raising its forecast for the rest of this year and next, thanks in part to an improving outlook for the long-stagnant commercial airplane business.

Time Warner fell 26 cents, to $16.65, after reporting profit that was ahead of expectations, and a boost in revenue thanks to the latest Harry Potter movie and its cable services and networks. The media conglomerate, which operates CNN, Warner Bros. and HBO, lost more customers from its long-troubled America Online division, but advertising buoyed revenue and profit there as well.

On the Nasdaq, shares of cable operator Comcast fell $1.18, to $27.56. Although the company beat analyst estimates by 2 cents a share, it disappointed investors by scaling back an earlier forecast that it would add 10,000 subscribers in 2004.

Other Indicators

* The New York Stock Exchange composite index rose 10.17, to 6357.77; the American Stock Exchange index rose 5.10, to 1226.61; and the Russell 2000 index of smaller-company stocks fell 3.41, to 541.20.

* Advancing issues narrowly outnumbered declining ones on the NYSE, where trading volume fell to 1.54 billion shares, from 1.6 billion on Tuesday. On the Nasdaq Stock Market, decliners outnumbered advancers by 8 to 5 and volume totaled 1.82 billion, up from 1.74 billion.

* The price of the Treasury's 10-year note rose $1.56 per $1,000 invested, and its yield fell to 4.59 percent, from 4.61 percent on Tuesday.

* The dollar rose against the Japanese yen and fell against the euro. In late New York trading, a dollar bought 111.67 yen, up from 110.99 late Tuesday, and a euro bought $1.2058, up from $1.2045.

* Light, sweet crude oil for September delivery settled at $42.90, up $1.06, on the New York Mercantile Exchange.

* Gold for current delivery rose to $389.00 a troy ounce, from $387.00 on Tuesday, on the New York Mercantile Exchange's Commodity Exchange.