JPMorgan Chase & Co reported better-than-expected first-quarter profit as debt trading and underwriting revenue surged, lifting the shares of the second-largest U.S. bank by as much as 4.5 percent.

JPMorgan said it set aside $10 billion in the quarter to cover losses on credit cards and consumer loans, and warned that if the economy worsens it may have to reserve even more.

But despite economic difficulty, Chief Executive Jamie Dimon said the bank has the money to repay the $25 billion in taxpayer funds it received from the U.S. government in October.

That's probably the most positive thing any investor could hear from them, said Rob Lutts, chief investment officer of Cabot Money Management in Salem, Massachusetts.

The bank was forced to take the bailout funds in October under the government's Troubled Asset Relief Program.

We could pay it back tomorrow, Dimon said on a conference call, adding that the bank is waiting for guidance from the government on when it can do so. Goldman Sachs Group Inc earlier this week raised $5 billion in a stock sale to help pay back the $10 billion it received from the government. Goldman also said it would return the funds when regulators gave the green light.

Dimon said JPMorgan could raise capital if it wanted to, adding that no bank should be allowed to repay the government before his bank. Keeping money received under TARP has become a scarlet letter for banks, he said.

JPMorgan shares were up 32 cents to $32.88 in afternoon trade on the New York Stock Exchange after rising as high as $34.01 in earlier composite dealings.

First-quarter net income available to JPMorgan common shareholders was $1.52 billion, or 40 cents a share, compared with $2.29 billion, or 67 cents a share, a year earlier. Analysts' average forecast was 30 cents a share, according to Reuters Estimates.

Net income before preferred dividends was $2.14 billion, down from $2.37 billion a year earlier. Revenue increased 45 percent to $25 billion.

Profit was driven largely by the investment bank, which reported record revenue driven by debt underwriting, and higher volumes in credit trading, emerging markets, currencies and rates businesses.

It was a historic quarter for the investment bank, Dimon said, noting the bank has increased market share across sectors, helped in part by the acquisition of Bear Stearns Cos just over a year ago.

But he said it was unreasonable to expect investment banking to remain as strong as it was in the first quarter.

CONSUMER WORRIES

While JPMorgan largely avoided the losses and writedowns on complex debt securities and subprime mortgages that hurt other banks in 2008, it is heavily exposed to consumer credit.

The bank reported net charge-offs of $1.1 billion from home equity loans in the first quarter, compared with $447 million a year ago; charge-offs for prime mortgages jumped to $312 million from $50 million.

The credit card business reported a loss of $547 million as delinquent loans soared and consumers spent less.

You have the continuing concerns that things are still dicey for the consumer, said Michael Holland, founder of investment management firm Holland & Co in New York.

Revenue from the bank's retail division was boosted by its acquisition of failed Seattle, Washington-based thrift Washington Mutual Inc last fall, as well as higher mortgage fees and a pickup in refinancing.

JPMorgan's ratio of tangible common equity to tangible assets, an increasingly popular measure of capital strength, was about 4.3 percent in the first quarter. That is high compared to weaker competitors, some of which have ratios below 3 percent. The market is not clear about what level is ideal for this ratio, and some analysts argue banks should be closer to 5 percent.

But with JPMorgan's capital ratios relatively high, the bank feels comfortable returning money to the United States, Dimon said. JPMorgan has no plans to participate in the government's Public-Private Investment Program, where investors receive U.S. support to buy bad loans and securities from banks.

We're certainly not going to borrow from the Federal government because we've learned our lesson about that, Dimon said.

JPMorgan shares have outperformed the broader sector so far this year, rising about 3 percent through Wednesday, compared with a 20 percent decline in the KBW Bank Index <.BKX>.

(Reporting by Elinor Comlay; additional reporting by Dan Wilchins and Jonathan Stempel; editing by Derek Caney and John Wallace)