Deutsche Bank has delivered a better-than-expected quarterly profit despite some unexpected costs and a decline in its investment banking revenue, sending shares of Germany's biggest lender up 2.2% in pre-market trading.

The bank posted a fourth consecutive quarterly profit, its longest streak in the black since 2012.

Net profit attributable to shareholders in the second quarter came in at €692 million, from a loss of €77 million a year earlier.

The figures were better than analyst expectations for a profit of €372 million .

Deutsche Bank's results were supported by a decrease in provisions set aside to cushion fallout from the coronavirus pandemic. Provisions for credit losses were 75 million euros, down from 761 million euros a year earlier.

A pocket of strength was the investment bank's advisory business amid a boom in dealmaking, with revenue surging 166% to €111 million.

An increase in asset management revenue and fees also helped boost the bottom line.

The profit figures are good news for Chief Executive Officer Christian Sewing, who launched a major restructuring in 2019 that involved shedding 18,000 staff in the hopes of returning the bank to profitability.

"Our priority now is to continue with our disciplined execution of transformation, quarter by quarter," Sewing said in a statement.

The company decided to abandon a key target - an aim of reducing costs to €16.7 billion by 2022.

The move came in after Deutsche Bank flagged a number of unexpected costs in recent months.

Sewing said he was committed to a 70% cost-income ratio target, as the lender will now focus on cost-to-income ratio.

Much has been riding on the performance of Deutsche's investment bank, the group's biggest revenue generator that helped the bank eke out a small profit for 2020, its first after five years of losses. Gains in the investment banking unit drove the bank to its strongest quarter in seven years at the start of 2021.

Revenue at the unit declined 11% in the second quarter from a year earlier. It was the biggest fall in investment banking revenue since the bank's revamp two years ago, but US rivals also saw a decline in the quarter.

Investors have wondered how sustainable progress will be as the bank continues to make efforts to boost profitability after years of losses.

The unit lost market share across an array of key services in the second quarter, data from Dealogic shows, demonstrating the fragility of recovery for the German lender