Indexes Eke Out Gains After Wild Session

The Dow chart looked like a yo-yo Thursday as traders pounded financials including Freddie Mac and Lehman Brothers and oil prices surged more than $5 a barrel.

Still, all three major indexes managed gains by the closing bell. The rally in the last hour of trading was enough to hoist the S&P 500 out of bear-market territory -- by about one point -- but the Dow Jones Industrial Average and Nasdaq remained on bear turf.

The Dow and S&P added 0.7 percent, while the tech-heavy Nasdaq gained 1 percent.

"Right now, on a short term basis, it’s painful," Sean Clark, investment chief of Clark Capital Management, said on CNBC. "Investor sentiment is pathetic right now," he added. "We're looking at levels of pessimism not seen in three decades."

Oil shot up more than $5, settling at $141.65 a barrel , after U.S. Secretary of State Condoleezza Rice said the U.S. won't back down on its stance on Iran and Iran fired back with more missile tests.

Fannie Mae and Freddie Mac plummetedamid concerns that shareholders may be wiped out if the government has to bail out the mortgage-finance firms. Fannie dropped 14 percent and Freddie plunged 22 percent.

Some analysts say the dual crisis at Fannie and Freddie marks a crucial juncture that is necessary for financials -- and therefore, the broader market -- to reach capitulation.

Bush administration officials are meeting with regulators to try to develop a contingency plan in case the firms are unable to raise the money they need, according to a report in the Wall Street Journal.

Fanning the flames, former St. Louis Federal Reserve President William Poole told Bloomberg that Fannie and Freddie were "insolvent'' and may need a U.S. government bailout.

Amid the firestorm, a Freddie Mac spokeswoman shot back that the firm "absolutely" has enough capital.

And Treasury Secretary Henry Paulson rushed to defend them. "Their regulator has made clear that they are adequately capitalized," Paulson told a House panel. Paulson and Federal Reserve Chairman Ben Bernanke were on Capitol Hill testifying about the need for a safety net on Wall Street.

Freddie was hit a lot harder than Fannie, which can be attributed to the fact that Freddie is worse off than Fannie, even though the two often get lumped together as one story, said Len Blum, managing director of Westwood Capital. Blum points out that Freddie's capital position is already $5 billion in the negative, if you look at its assetes at market value.

"Fannie and Freddie have histories of undependable accounting, and they continue to pile risk onto their already highly levered balance sheets," Blum wrote in a note to clients. "They are a train wreck waiting to happen."

Offering fresh evidence of how bad things are in the housing market, RealtyTrac reported that U.S. home foreclosure filings jumped 53 percent in June from a year earlier, although they were down 3 percent from May, and are expected to rise further.

Lehman Brothers , which has already been pummeled over concerns about the need for more capital, took a fresh beating that sent the stock down more than 12 percent. The culprit was likely dangerous rumors that firms don't want to do business with Lehman anymore.

The Lehman speculation was so rampant that Pimco and SAC Capital came out and said that they continues to trade with Lehman, despite rumors that they are among the firms cutting off trading with the brokerage, CNBC's Charlie Gasparino reported.

Wachovia took a hit after the regional bank said mortgage and legal problems will result in a $2.6 billion to $2.8 billion second-quarter loss, much larger than expected, and named a new CEO. Its shares dropped more than 8 percent.

Merrill Lynch and BlackRock have scheduled talks about a possible sale of at least part of Merrill's 49 percent stake in the money-management firm, sources familiar with the situation told CNBC, adding that the discussions are likely to continue through the end of the week.

The market was buzzing with deal news.

Dow Chemical announced plans to buy rival Rohm & Hoss for $18.8 billion. The deal represents a 74 percent premium on Rohm & Haas's $44.83 market close Wednesday, sending shares up more than 60 percent . Dow shares fell more than 4 percent.

The deal boosted water-related stocks as it expands Dow's water business through Rohm's partnership with water-treatment firm Nalco.

Calgon Carbon, which makes activated carbon, an essential component of water purification, jumped nearly 9 percent , while Nalco advanced nearly 2 percent .

Retailers logged their best month for retail sales in more than a year, with more than two-thirds beating expectations, helped by good weather and the tax rebates.

Discounters led the way.

Wal-Mart said its same-store sales rose 5.8 percent, more than expected, and raised its second-quarter earnings forecast. TJMaxx and Ross Stores also topped expectations and raised their guidance.

Wal-Mart's Hipper rival Target reported its same-store sales rose 0.4 percent, when analysts had expected a decline.

Still, the S&P retail-sector index dropped more than 3 percent as department stores and women's apparel and accessories chains continued to suffer and investors mulled what will charge consumer spending after the stimulus checks.

AIG was the biggest decliner on the Dow, followed by General Motors, as the auto maker's stock continued to languish at a more than 50-year low.

ADRs of Toyota Motor advanced after the Japanese auto maker said it would start building its Prius hybrid in the U.S. in 2010 and curb production of some of its big trucks.

Alcoa was the biggest gainer on the Dow as aluminum prices hit a new high. The aluminum maker kicked off the second-quarter earnings season earlier this week, reporting earnings and revenue that declined but beat forecasts.

General Electric , parent of CNBC, reports on Friday. Analysts are forecasting earnings between 53 and 54 cents a shareand don't expect to be caught off guard by the conglomerate like the last quarter. Earlier, GE announced plans to spin off its consumer and industrial units, which include the appliances and lighting divisions.

Yahoo slipped 1.3 percent as the struggling Internet portal announced plans to share its search technology with smaller rivalsand denied rumors that embattled chief yahoo Jerry Yang is planning to resign.

Apple shares rose 1.4 percent ahead of the debut of the iPod 3G on Friday.

Initial jobless claims fell by 58,000 last week, the largest decline since September 2005.

Economists had expected a more modest 9,000-claim drop but pointed to the fact that this is the time of year for auto-retooling shutdowns, which often skew the jobless numbers, and the surprise may have been a case of off-target seasonal adjustment.

(Is the Dow due for a bounce? Click on the video at left.)

The Bank of England kept its main interest rate steady at 5 percent, as widely expected, despite rising inflation.

As for U.S. rates, the Fed should raise its target to a "neutral" setting as quickly as reasonably possible to prevent high inflation taking root, Federal Reserve Bank of Kansas City President Thomas Hoenig said.

The next U.S. Fed meeting on interest rates is set for August 5.

Asian stocks closed mixed, as credit concerns persisted, while European stocks fell because of uncertainties over the economy.

Still to Come:

THURSDAY: Chevron interim report after the bell
FRIDAY: Import/export prices; international trade; consumer sentiment; Treasury budget; GE earnings; Apple's iPod 3G hits store shelves

Send comments to cindy.perman@nbcuni.com.