Stocks held onto gains from the afternoon rally after oil topped $122 a barrel. Speculation that a deal is still possible between Microsoft and Yahoo gave techs a boost.
Traders said some of the day's gains could be attributed to optimism for the second half.
"There's been a lot of stimulus thrown in this environment and we think we're closer to the bottom of this cycle than people realize," Keith Wirtz, president of Fifth Third Asset Management, told CNBC, citing the latest GDP reading, earnings (excluding financials) that are A "painting a pretty good picture" and a belief in the market that the Federal Reserve is done cutting rates for a while.
"On the floor, there's a feeling that the consumer may have hit a wall about three weeks ago," Art Cashin, director of floor operations at UBS, told CNBC. "How much it costs to fill up the tank ... how they're seeing signs of cutbacks ... that's all anecdotal to what starts to show up in the numbers."
Alcoa was the top gainer on the Dow, followed by Microsoft .
Anadarko shares shot up 10 percent, helped by crude prices and after the independent exploration and production company late Monday posted better-than-expected earnings and issued a healthy forecast.
Yahoo shares rebounded more than $4 -- after Monday's 15-percent drop -- as shareholders latched on to the possibility that a deal with Microsoft could still happen.
"It seems like the shareholders are going to try to make something happen, but the stock is acting like that's real," Bobby Harrington, head of block trading at UBS, told Reuters.
In an interview, Yahoo President Sue Decker said part of the problem with the breakdown in negotiations was that Microsoft never put its $33 a share offer in writing.
Meanwhile, MicrosoftChairman Bill Gates said Tuesday that the software gianthasn't ruled out partnerships with other companiessince the Yahoo deal went bust but nothing is imminent.
Shares of Fannie Maerecovered after the housing lender assuaged investor concerns in a conference call, saying it plans to raies $6 billion in capital and is improving shareholder value.
"Right now, we are in the belly of this cycle," Daniel Mudd, Fannie Mae's chief executive, said on the conference call. "The initial period of [disruption] in the marketplace appears to be dissipating. The capital markets are recovering balance."
Earlier, Fannie Mae reported its third straight quarterly loss and lowered its common stock dividend, projecting that credit losses will stretch into 2009.
Swiss bank UBS said it plans to cut 5,500 jobs in one of the biggest purges so far in this financial-market crisis. The company also announced a preliminary deal with U.S. asset manager BlackRock to sell $15 billion in subprime mortgages.
A day earlier, U.S. brokerage firm Morgan Stanley announced its planning another round of layoffs, finalizing a plan to reduce its workforce by another 5 percent. It's part of the next wave of layoffs headed for Wall Street, with cuts in the works at both JPMorgan Chase and Lehman Brothers , CNBC has learned.
Also Monday, Merck said it was paring its sales force by 1,200 jobsfollowing the FDA rejection of Merck's new cholesterol drug, Cordaptive.
Target announced plans to sell a 47-percent stake in its credit-card businessto JPMorgan Chase for $3.6 billion. The discount retailer said this was a dream deal with a dream partner. According to terms of the deal, Target will still run the unit and get a cash infusion, while JPMorgan has the rights to future profits.
"We expect to get hundreds of millions of dollars from profit from this venture unless we really screw it up," Target CFO Doug Scovanner said of the JPMorgan deal during a conference call with analysts. "Personally, I think this is what Dire Straits had in mind in the 1980s anthem, 'Money for Nothing.' I think this is wonderful."
Legg Mason shares skidded after the money manager posted its first-ever lossamid a hefty charge related to a bailout of money-market funds exposed to risky securities.
Yum Brands , which operates fast-food chains including Taco Bell, KFC and Pizza Hut, said it will raise its quarterly dividend to 19 cents from 15 cents.
On the earnings front, Disney and Cisco Systems are set to report after the closing bell.
TUESDAY: Indiana, North Carolina primaries; Earnings from Cisco and Disney after the bell
WEDNESDAY: Mortgage applications; Productivity; Pending home sales; Crude inventories; Consumer credit; Earnings from News Corp., Transocean
THURSDAY: Retail same-store sales; Jobless claims; Wholesale trade; Cablevision earnings
FRIDAY: Trade report
Send comments to email@example.com.