Updated from 3:30 p.m. EST

Stocks on Wall Street rocked higher and lower Tuesday, as traders weighed encouraging news from several big technology companies against troubles in the financial sector and the automakers' group.

But in the end, the major indices racked up gains. The

Dow Jones Industrial Average

ended up 151.17 points, or 1.8%, at 8424.75. The

S&P 500

gained 8.36 points, or 1%, at 859.11. The

Nasdaq

tacked on 1.22 points, or about 0.1%, at 1483.27.

Two pieces of news provided an initial lift to technology shares. Computer hardware and software maker

Hewlett-Packard

(HPQ) - Get Report

was partly responsible, after the company said its fourth-quarter profit would exceed analysts' expectations. Shares of H-P, part of the Dow, rose 14.1% to $33.48.

Charles Rotblut, senior market analyst at Zacks Investment Research, said that H-P's earnings beat "actually was a very big surprise." He said that eight analysts had cut their quarterly forecasts in the past month, including five in the last week.

However, "It does seem like it's a bit of an outlier, given everything else we're seeing going on," said Rotblut. "Based on the economic trends we're seeing, I really don't have a very optimistic view for the technology sector in the short term."

Another boost came from

Yahoo!

(YHOO)

, which said CEO Jerry Yang is set to step down from his position as soon as the Internet firm can find a replacement. Yang's tenure was recently marked by a refusal to sell his company to

Microsoft

(MSFT) - Get Report

. Yahoo! shares were likewise rose 6.7% to $11.34.

Financial firms continued to look weak as the new session arrived. Asset manager

BlackRock

(BLK) - Get Report

joined the set of companies to announce layoffs by announcing its first round of job cuts in its 20-year history, according to a report by

Bloomberg

.

Meanwhile,

analysts

at Deutsche Bank cut their price target on

Citigroup

(C) - Get Report

to $9, which on Monday announced plans to lay off 52,000 workers.

As the financials slim down in an effort to stem damage from the credit crisis,

Federal Reserve

Chairman Ben Bernanke, Federal Deposit Insurance Corp. head Sheila Bair and Treasury Secretary Henry Paulson were testifying before Congress to discuss their $700 billion

Troubled Asset Relief Program

, which was designed to bolster liquidity for banks with stressed balance sheets.

Secretary Paulson said at the event that he does not plan to initiate new programs beyond the TARP to prop up ailing banks. He also said he does not believe that the financial-relief package will wholly fix the economic problems that have emerged as a result of the credit crunch and cautioned against using the package's funds to soothe problems outside the financial sector.

Paulson's refusal to endorse additional relief for the financial system is confusing, said Michael Pento, senior market strategist at Delta Global advisors. "Now that the Democrats are in power, it seems like the Republicans are trying to be backing away from fixing the economy. Perhaps in some insidious way they would like the economy to be weak and blame it on the Democrats -- and I'm a Republican," he said.

Setting Paulson's motivations aside, Pento said that it is reasonable for the Treasury Secretary to say that the TARP is not a panacea. He said that the government has been devaluing the dollar in an effort to keep asset prices higher. The major averages are caught in a trading range, weighed down by negative economic news but propped up by the government's monetization efforts, which act as an inflationary force. "Overall we're just going to be treading water," he said. "It's a trader's market."

Rotblut of Zacks didn't fully agree, saying the administration deserves some praise for being creative in the face of a crisis. "Considering there's going to be a transition in the administration I do think he's trying to allow for some flexibility," he said. "Despite all the criticism, I think it's important that we have some action. In a crisis situation, action's always better than non-action."

Rotblut said that any solution to turmoil in the financial markets would be an educated guess at best, and declines in Libor rates and improvement in the Treasury-Eurodollar spread indicate that lending markets have been calmed somewhat by recent government initiatives.

Jeff Saut, chief investment strategist at Raymond James Financial, said that the Oct. 10 lows in the major averages marked capitulation and a price panic. He said that since then, the market largely survived a retest of those lows Nov. 13 and now appears to be forming a triple bottom, which is typically followed by a short-term move to the upside.

"That doesn't mean that we've started a new secular bull market, but it does mean we could begin the fabled Santa rally," said Saut, referring to a rise in stock prices that sometimes occurs in late December.

The automakers, also lately on the ropes, were once again on investors' radar, as

Mazda Motor

said

Ford

(F) - Get Report

was reducing its stake in the Japanese company to 13% from 33%. Ford, along with

General Motors

(GM) - Get Report

and

Chrysler

, are facing mounting cash-flow problems on declining vehicle sales, credit crunch -related financing troubles and substantial legacy costs.

As members of Congress debate the merits of a potential $25 billion aid package for the automakers, CEOs of Ford, GM and Chrysler were appearing before the Senate Banking Committee to plead their case for federal money.

Looking at the day's

earnings

, hardware store operator

Home Depot

(HD) - Get Report

announced earnings that fell 31% year over year on declining revenue, but the results were enough to edge past analysts' estimates.

Fashion retailer

Saks

(SKS)

swung to a third-quarter loss.

Shares of

Corning

(GLW) - Get Report

were taking a beating after the glass-panel maker withdrew its fourth-quarter guidance on weakening demand for LCD televisions and computer monitors.

In merger news,

Alpha Natural

(ANR)

and

Cliffs Natural Resources

(CLF) - Get Report

announced they had agreed to drop previous plans for a merger valued at about $10 billion.

Shifting to economic data, the Bureau of Labor Statistics reported that producer prices fell by a record 2.8% in October. Economists were expecting a decline of 1.8%. The core rate

PPI

increased by 0.4%, above expectations for a 0.1% uptick.

The National Association of Realtors said that, for the third quarter, the median U.S. home price fell 9% year over year and that the price of houses has fallen in 80% of U.S. cities. Separately, the National Association of Home Builders - Wells Fargo housing market index fell to nine for November from 14 in October, reaching a record low.

As for commodities, crude oil was down 56 cents to close at $54.39 a barrel. Gold fell $9.30 to settle at $732.70 an ounce.

Longer-dated U.S. Treasury securities were rising in price. The 10-year note was adding 30/32 to yield 3.53%. The 30-year was up 31/32, yielding 4.14%. The dollar was gaining on the euro and pound but weaker vs. the yen.

Overseas, European exchanges such as the FTSE in London and the DAX in Frankfurt were mainly trading higher. In Asia, Japan's Nikkei and Hong Kong's Hang Seng closed with losses.