JPMorgan Chase & Co's first-quarter profit fell 3 percent as recent improvement in trading and deal-making failed to lift investment banking revenue to year-earlier levels, but results still beat Wall Street expectations.

JPMorgan is the first major U.S. bank to announce results for the quarter. Its recovery after a dismal 2011 fourth quarter bodes well for rivals such as Goldman Sachs Group Inc, Morgan Stanley, Bank of America Corp and Citigroup Inc, which will all report results in the coming days.

We were expecting a very good quarter and they have outshined even our very high estimates, said Gary Townsend, president and chief executive of Hill-Townsend Capital. We're seeing good credit trends. We're seeing a snapback in capital markets operations.

The results follow a surge of investor optimism for banks that has led the stock market higher this year. The KBW index of bank stocks is up more than 23 percent this year, and JPMorgan shares have risen 35 percent.

JPMorgan, the biggest U.S. bank by assets, said first-quarter net income was $5.4 billion, or $1.31 a share, compared with $5.6 billion, or $1.28 a share, a year earlier.

Analysts had been expecting $1.18 a share, according to Thomson Reuters I/B/E/S.

Per-share earnings rose because of a 4 percent decline in quarter-end share count due to share buybacks.

Revenue was $27.4 billion, up 24 percent from the 2011 fourth quarter and up 6 percent from the first quarter of 2011.

Investment banking posted net revenue of $7.3 billion, down 11 percent from a year earlier but up 68 percent from the 2011 fourth quarter.

JPMorgan's retail financial services booked a profit of $1.75 billion, compared with a loss of $399 million a year earlier, when the division was the bank's worst performing unit. Revenue in the division, which houses the bank's expanding branch banking system, climbed 40 percent to $7.65 billion.

The revenue is what really impressed me. It tells me there's more economic activity, maybe, than what we were previously thinking - more demand for credit, more demand for banking services, more business out there, said Joe Terril, founder of Terril & Co, a money manager in St. Louis, Missouri.

JPMorgan shares were down 0.3 percent in premarket trading.

(Reporting by David Henry in New York; additional reporting by Ilaina Jonas, Lauren LaCapra and Jed Horowitz; Editing by Paritosh Bansal, Gerald E. McCormick and John Wallace)