Wells Fargo & Co said it expects to post a record $3 billion first-quarter profit, causing its shares to soar 31.7 percent and providing a welcome jolt to the stock market and a still-troubled banking sector.

The preliminary results suggest that lenders focused on traditional banking activities may handle the recession better than analysts and investors expect, at a time the government is performing stress tests on 19 major banks.

San Francisco-based Wells Fargo is the fourth-largest U.S. bank, and the nation's first major lender to indicate how it fared in the January-March period.

In this terrible environment, to exceed on the upside is going to raise the bar pretty high, said Matt McCormick, an analyst at Bahl & Gaynor Investment Counsel in Cincinnati.

Wells Fargo said profit rose about 50 percent from $2 billion a year earlier. Excluding preferred stock dividends, the bank said quarterly profit was $2.3 billion to $2.4 billion, or 55 cents per share, on revenue of about $20 billion.

Analysts on average expected profit of 25 cents per share on revenue of $18.81 billion, Reuters Estimates said. Wells Fargo expects to report full quarterly results on April 22.

The results are the first to include Wachovia Corp, a larger rival Wells Fargo bought for $12.5 billion on December 31.

Wells Fargo took tens of billions of dollars of writedowns when it bought Wachovia, which had been struggling with a giant mortgage portfolio. In the first quarter, however, the Wachovia businesses performed better than expected, Wells Fargo said.

The main story is that traditional banking businesses, and the mortgage banking businesses, were very solid, Wells Fargo Chief Financial Officer Howard Atkins said in an interview. He said the bank, which makes about one in seven U.S. mortgages, is adding market share as home loan refinancings soar.

Wells Fargo shares closed up $4.72 at $19.61, helping push the KBW Bank Index up 20.1 percent and the Standard & Poor's 500 rose 3.8 percent. Warren Buffett's Berkshire Hathaway Inc is the bank's largest investor.

Among larger banks, JPMorgan Chase & Co rose 19.4 percent, Citigroup Inc rose 12.6 percent, and Bank of America Corp rose 35.3 percent. They are scheduled to report quarterly results on April 16, 17 and 20, respectively.

Thursday trading volume in Wells Fargo, JPMorgan, Citigroup and Bank of America topped 2 billion shares, Reuters data showed.

PAYING BACK THE GOVERNMENT

Atkins said it was purely Wells' decision to release partial results early, saying that given the importance of the Wachovia acquisition, we felt it was important to get information into the market as quickly as possible.

He also said results show very little impact from a new accounting rule giving banks more freedom to value assets as they would in normal markets rather than at distressed prices.

Wells Fargo got $25 billion from the bank bailout plan known as the Troubled Asset Relief Program. Atkins said the bank would like to repay TARP as soon as practical but that the government will decide ultimately when that can be done.

The bank said its tangible common equity ratio is about 3.1 percent, lower than many analysts prefer.

Fox-Pitt Kelton analyst Andrew Marquardt nevertheless wrote that the bank may be ready to pay back TARP by year-end.

Atkins declined to comment on the stress tests, though a person familiar with them said some of the 19 banks may have sizable capital needs. The person spoke anonymously because the tests are ongoing.

Thomas Hoenig, president of the Federal Reserve Bank of Kansas City, said that once large banks' ability to handle a deep recession is assessed, it is likely that few would require further government intervention, according to the text of a Thursday speech in Tulsa, Oklahoma.

NOT YET IN THE CLEAR?

Wells Fargo said it made more than $100 billion of mortgage loans in the first quarter, and had $190 billion of applications, up 64 percent from the fourth quarter.

It expects net chargeoffs of $3.3 billion, down from about $6.1 billion in the fourth quarter for Wells Fargo and Wachovia combined, and plans to add $1.3 billion to loss reserves.

They are probably one of the best positioned to expand and benefit from the particularly low mortgage rate environment, said Michael Farr, president of Farr, Miller & Washington in Washington. I don't think that this is an all-clear for Wells Fargo. They have got a huge portfolio of home equity loans.

Paul Miller, an FBR Capital Markets analyst, maintained his underperform rating on Wells Fargo, saying credit quality materially deteriorated and the bank is underreserving.

Wells Fargo slashed its dividend 85 percent in March, saving $5 billion a year. It also plans $7 billion of cost cuts, including $5 billion annually tied to Wachovia, which Atkins said will begin to emerge in the second quarter.

The bank has no plans to shed the Evergreen Investments business, which Wachovia owned, an Evergreen spokeswoman said.

(Reporting by Elinor Comlay and Jonathan Stempel; additional reporting by Paritosh Bansal in New York and Karey Wutkowski in Washington; editing by John Wallace and Tim Dobbyn)