The country’s largest mortgage lender said 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.

On a per-share basis, quarterly earnings were $1.01, exactly what analysts had forecast.

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.

Analysts expect banks to report weak revenue for the second quarter as interest rates remain at historic lows.

Wells Fargo’s revenue declined 1 percent to $21.1 billion. That was slightly better than the $20.8 billion analysts had expected, according to the data provider FactSet.

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. The bank said this increase in the credit quality of its loans, along with rising home prices, allowed it to free up $500 million that had been set aside to protect against losses.

The country’s biggest mortgage lender is often seen as a bellwether for the overall housing market. To judge by the bank’s results, sales of new houses and refinancing activity have cooled off. Wells Fargo funded $47 billion worth of mortgages in the second quarter, a steep drop from the $112 billion in home loans made a year earlier.

Wells Fargo has countered the decline in home loans by turning to car loans, investment services and other businesses. As a result, total loans increased 4 percent to $829 billion.

Meanwhile, customers put more money into the bank, pushing total average deposits up 9 percent to $1.1 trillion in the second quarter. This wound up pinching Wells Fargo’s profits, because the difference between what it paid to depositors and what it received in interest payments shrank. Net interest margin, a measure of this profit, sank to 3.15 percent from 3.47 percent the year before.

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