Wells Fargo’s profits jumped 57% in the second quarter thanks to higher interest rates and loan balances, the bank said Friday.

San Francisco-based Wells earned $4.9 billion, or $1.25 per share in the period, on $20.5 billion in revenue. That beat Wall Street analysts’ targets, which called for profit of $1.16 per share on $20.1 billion in revenue.

In the same period last year, Wells earned $3.1 billion, or 75 cents per share, on $17 billion in revenue.

Like other banks, Wells has benefitted from the Federal Reserve’s aggressive interest rate hikes as the central bank tries to bring down the worst inflation since the 1980s.

The bank reported that its net interest income jumped 29% to $13.2 billion, from $10.2 billion a year ago.

Wells said it set aside another $949 million in its allowance for credit losses, mostly for commercial real estate office loans and higher credit card loan balances.

“While we haven’t seen significant losses in our office portfolio to-date, we are reserving for the weakness that we expect to play out in that market over time,” said CEO Charlie Scharf.

Wells is still trying to exit the strict federal guidelines imposed in 2018 that sets its asset cap at just under $2 billion after a series of scandals, including the uncovering of millions of fake checking accounts its employees opened to meet sales quotas. That order was expected to last only a year or two, but additional improprieties surfaced, making regulators skeptical about the bank’s efforts to clean up its act.

Shares of Wells Fargo rose nearly 3% in premarket trading.