Stocks struggled to stretch their rally to four days in a row as optimism about second-quarter corporate profits faced off against worries about the rebounding price of oil.
The Standard & Poor's 500 stock index climbed three points to 1,222.21, which left the broad market index just three points short of a new four-year high.
Regarded by professionals as the best measure of the market, the S&P 500 briefly topped 1,225.31 during the day. That was the high it reached earlier in the year and the high point going back more than four years.
The S&P's altitude was hailed as a sign of Wall Street's strength, but market commentators were cautious about proclaiming that stocks will break out of their doldrums and climb to new highs.
The S&P has been trading within a range of less than 100 points all year. A move beyond that range would probably encourage more investors to buy stocks, boosting the market still higher.
Technology stocks climbed along was the S&P, pushing the Nasdaq Stock Market composite index up almost eight points to 2,143.15.
The Dow Jones industrial average, however, faltered in the final few minutes of trading and closed down almost six points at 10,513.89.
The Dow's decline was blamed on crude oil prices, which climbed back over the $60 a barrel mark, gaining $1.70 to $60.62 a barrel. Oil traders are worried about Wednesday's update on petroleum stocks, which they fear will fall as the result of Hurricane Dennis. Although the storm missed most of the oil-producing areas of the Gulf of Mexico, it knocked askew one giant oil platform that was listing in the water today in need of significant repairs.
Wednesday could bring another day of treading water to Wall Street, because the crucial consumer price index report is due on Thursday. The CPI is the government's most important gauge of inflation and is seen as a predictor of what the Federal Reserve will do on interest rates. Any hint of growing inflation could spook the market, which is hoping the Fed will soon complete its escalation of interest rates. That's not going to happen if inflation snaps back.