Shannon Stapleton/Reuters

Wells Fargo, the nation’s largest home lender, posted a 19 percent increase in second-quarter profit on Friday as it overcame a drop-off in the mortgage market on its way to record earnings.

While the bank’s home loan machine showed signs of slowing as a recent uptick in interest rates discouraged borrowers from refinancing their mortgages, Wells recorded its 14th-consecutive rise in quarterly profit and ninth-straight record report.

The results, bolstered by declining expenses and growth across the bank’s deposit and broad lending business, included net income of $5.5 billion, or 98 cents a share. That compared with $4.6 billion, or 82 cents a share, in the period a year earlier. The new returns outpaced the expectations of analysts polled by Thomson Reuters, which had forecast earnings of 93 cents a share.

Revenue, roughly flat at $21.4 billion, also exceeded expectations.

“Wells Fargo achieved outstanding results for the second quarter,” the bank’s chief executive, John G. Stumpf, said in a statement.

Mr. Stumpf noted that the gains came despite a “dynamic economic and interest rate environment.”

But for Wells, which is based in San Francisco, this environment could spell trouble ahead. With the bank’s fortunes rising and falling with its lending business — the result of creating roughly a third of all mortgages in the country — it could signal a slowdown for the broader lending industry.

Until now, banks have benefited from government policies intended to stimulate the economy in the wake of the financial crisis. As the Federal Reserve cut interest rates in recent years, for example, it spurred millions of borrowers to refinance their home loans to take advantage of the lower costs.

But the Fed has signaled in recent weeks that it could ease its stimulus as the economy continues to recover. The warning has prompted investors to drive up interests rates around the globe, putting a crimp in the refinance business.

The shift started to show in Well Fargo’s second-quarter results. The bank received $146 billion worth of quarterly home loan applications, down from $208 billion in the period a year earlier. Its mortgage originations totaled $112 billion, down from $131 billion.

Still, the bank’s overall loan portfolio, which includes commercial and consumer lending, actually rose 3 percent to $802 billion. The results suggested that the surge in interest rates came too late in the second quarter to significantly impact the bank.

A bump in credit cards and commercial lending — and record origination of auto loans — further offset the home loan slowdown. The bank’s total average deposits reached $1 trillion, up 9 percent from a year ago.

The bank also benefited from a dip in expenses. One crucial expense — building a reserve for bad loans — had a significant decline. This move reflected improvements in the quality of loans.

Wells, along with JPMorgan Chase, kicked off bank earnings season. Citigroup, Goldman Sachs and other Wall Street giants will report next week.