Wells Fargo said its second-quarter profit edged up 3 percent, helped by higher deposit balances and a drop in the amount of loans that went bad. Revenue slipped.

The country’s largest mortgage lender said early Friday that net income rose to $5.42 billion for the three months ending in June, up from $5.27 billion a year earlier. That’s after taking out dividends for preferred stock.

Revenue declined 1 percent to $21.1 billion over the year. That was better than the $20.8 billion analysts had expected, according to the data provider FactSet.

Measured for every share, quarterly earnings were $1.01, exactly what analysts had forecast.

Wells Fargo funded $47 billion worth of mortgages in the first quarter, a steep drop from the $112 billion in home loans made a year earlier. Total loans crept up 4 percent to $829 billion, and total average deposits increased 9 percent to $1.1 trillion.

At the same time, Wells Fargo slashed its losses on loans in the second quarter by 52 percent to $717 million. That’s down from $1.2 billion the year before.

As the first major bank to post results this earnings season, San Francisco-based Wells Fargo & Co. sets the tone for the rest of the industry. The third-largest U.S. bank by assets has turned a profit in every quarter since 2009.

The bank’s stock fell 51 cents, or 1 percent, to $51.30 in premarket trading. Wells Fargo has traded as high as $53.08 and as low as $40.07 over the past year.

Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.