NEW YORK — Wall Street ended a grueling first half quietly Monday, closing mixed as investors again based their trades on what has become the dominant force in the market: the price of oil. The major indexes closed out the first six months of 2008 with double- digit declines and are perilously close to the levels of a bear market.

This was the worst first half for the Dow Jones industrials since 1970, when the country fell into recession. The more diverse Standard & Poor’s 500 and Nasdaq composite indexes had their worst first half since 2002, when Wall Street was still suffering through the aftermath of the dot-com bust, the Sept. 11, 2001, terrorist attacks and a recession.

On Monday, stocks pulled back in the early going as oil reached yet another record, this time, above $143 a barrel. The market then gathered some strength as crude lost momentum and allowed some investors to consider buying equities that have been turned into bargains by months of volatility.

There is little expectation on the Street that the chaos of the first half will soon end. Besides the punishing effect of higher oil, which threatens to stifle consumer spending and, in turn, an economy still struggling to grow, the stock market is still contending with warnings of losses at financial companies — the continuing fallout of the housing slump and the credit crisis that began nearly a year ago.

These problems that show little sign of being resolved soon left Wall Street in tatters as the first half ended. The Dow is down nearly 20 percent from its record high of 14,198.09, set in October, putting the blue chips on the threshold of a bear market.

The market did have a spring recovery, which began in March, but it foundered in May as the combination of credit problems and higher oil costs rattled investors.

Financial stocks, which were leading the market higher before the credit crisis struck, ended the half with even steeper losses than anyone expected — just a few months ago, there were predictions that the credit crisis would soon end. Airline stocks have been devastated by the rising price of oil. Detroit automotive stocks, as ever battling competition from overseas makers, are also being pummeled by the sagging economy and higher energy prices.

Investors wondering how the markets will fare will most likely devote unusual scrutiny to parsing reports on the economy and corporate earnings, which will arrive in force in the coming weeks. And right now, there appears to be little optimism.

“We’ve seen year-over-year estimates decline,” said Christopher Johnson, president of Johnson Research Group in Cincinnati. “It’ll be a critical season.”

Investors made relatively small bets ahead of the coming earnings and as the quarter moved toward a close. The Dow rose 3.50, or 0.03 percent, to 11,350.01.

The S&P 500 index rose 1.62, or 0.13 percent, to 1,280.00, and the technology-laden Nasdaq fell 22.65, or 1.21 percent, to 2,292.98.

Light, sweet crude, which began the year at $96 a barrel, fell 21 cents Monday to settle at $140.00 on the New York Mercantile Exchange while retail gasoline set a new national average of $4.086 a gallon, according to a survey of stations by AAA, the Oil Price Information Service and Wright Express.

“With the Dow nearing bear-market territory, it’s going to keep investors on edge,” said Peter Cardillo, chief market economist at the New York brokerage Avalan Partners.

He’s looking at economic data due this week on manufacturing and employment as possibly offering some reassurance to investors.