Deutsche Bank confirmed on Thursday it had struck a deal with its works council to shut a quarter of its German branches, slightly fewer than expected, as it cuts costs and revamps retail banking.

Germany's biggest lender has embarked on a strategic overhaul, announcing in 2015 that it would cut 9,000 staff positions, of which 4,000 would be in Germany.

It will first shed almost 3,000 jobs in Germany, with 2,500 in its retail unit, while talks with employee representatives about further cuts continue, Deutsche Bank said in a statement.

This will leave Deutsche Bank with 535 branches in Germany, compared to an original target of 500. It will start closing down branches before the end of the year, with the bulk to be shut in the first half of 2017.

"We are meeting challenges of low interest rates, tougher regulation and especially a changed behavior of customers," retail head Christian Sewing said, adding that job cuts - which the bank hopes to carry out without forced redundancies - were needed to keep it competitive.

Deutsche Bank said it has invested up to 2 million euros ($2.3 million) each to refurbish 120 branches in recent years.

While Deutsche Bank is thinning out its network within large cities and in rural areas where it sees little potential, it is stopping short of a broad pull-back from smaller towns.

It is also creating 140 jobs in its business with small and medium sized corporate clients, Germany's famed Mittelstand, as well as 100 jobs in its private banking unit.

This story is developing. Please check back for further updates.