(Reuters) -Wells Fargo & Co swung to a profit in the second quarter, smashing Wall Street expectations on Wednesday, as it released $1.6 billion in funds set aside to cover soured loans.

FILE PHOTO: A Wells Fargo logo is seen in New York City, U.S. January 10, 2017. REUTERS/Stephanie Keith

Wells Fargo has been operating under tight regulatory scrutiny since 2016, when details emerging from a sales scandal led to the departure of two chief executives and cost the bank billions of dollars in litigation and remediation expenses.

Under an order imposed by the Federal Reserve in 2018, the bank is not allowed to let its assets rise above $1.95 trillion.

Wells Fargo, however, began to rein in costs this year, signaling that it may finally be emerging from the episode that has dogged it for nearly five years.

The fourth-largest U.S. lender reported a profit of $6 billion, or $1.38 per share, for the latest quarter, compared with a net loss of $3.85 billion, or $1.01 per share, a year earlier.

Analysts on average had expected a profit of 97 cents per share, according to estimates from Refinitiv.

“Wells Fargo benefited from the continued economic recovery, strong markets that helped drive gains in our affiliated venture capital businesses, and our progress on improving efficiency,” Chief Executive Officer Charlie Scharf said.

“Headwinds of low interest rates and tepid loan demand remained,” he added.

Total revenue rose 11% to $20.27 billion.

The bank’s results included a $1.6 billion pre-tax reduction in the allowance for credit losses set aside to cover defaults from consumers and companies because of the COVID-19 pandemic in the second quarter.

Its results in the prior-year quarter were hit by $9.5 billion in loan-loss reserves and a $1.2 billion loss tied to the sales scandal.

Bank-wide expenses fell 8%, primarily due to lower operating losses, as well as reduced spending on consultants and contractors, the bank said.

Controlling cost is central to Scharf’s turnaround plan.

He said last year he was aiming to cut $10 billion from the bank’s roughly $54 billion annual expense base over several years. It remained unclear, though, how much longer the bank expects to operate under the regulatory asset cap, which has curtailed loan and deposit growth needed to boost interest income and cover costs.

Average loans fell to $854.7 billion in the quarter from $971.3 billion a year earlier.

Reporting by Noor Zainab Hussain in Bengaluru and Matt Scuffham in New York; Editing by Anil D’Silva

Read More