Volkswagen and its powerful labor unions agreed to cut 30,000 jobs at the core VW brand in exchange for avoiding forced redundancies in Germany until 2025, a compromise which leaves the carmaker’s profitability still lagging rivals.

The turnaround plan announced on Friday will lead to 3.7 billion euros ($3.9 billion) in annual efficiency gains and lift the VW brand’s operating margin to 4% by 2020, from an expected 2% this year.

That target still remains below rival European carmakers such as Renault and Peugeot Citroen, which are targeting an operating margin of 6% in 2021.

Volkswagen vlkay , Europe’s largest automaker is trying to increase savings at its biggest business in its home base of Germany, where its costs are high.

It must also find billions of euros to pay fines and settlements stemming from its diesel emissions cheating scandal as well as fund a strategic shift towards electric and self-drive cars.

Volkswagen’s labor leaders said management had agreed to avoid forced redundancies in Germany until 2025 a step which clears the path to cutting 23,000 jobs via buyouts, early retirements and by reducing part-time staff.

Jobs will also be cut in North America, Brazil, and Argentina, VW said, without being more specific. Around 114,000 employees work for VW brand in Germany.

Labour leaders agreed to the cuts in exchange for a management pledge to create new 9,000 new jobs in the area of electric cars, mainly at factories in Germany.

Analysts and investors nonetheless welcomed the deal, sending the share more than 2% higher to the top of the blue-chip DAX index in early Frankfurt trading.

Hedge fund TCI, which has been critical of Volkswagen management, said it looked like a good deal all round provided it could be made to stick.

“As long as they are net savings—the savings are not given back by increased costs elsewhere in the organization,” said TCI partner Ben Walker.

“They’ve just to deliver now. It’s easy to talk. They now have to delivery and execute,” he added.

 

Labour leaders were pleased with the outcome.

“The most important message is the jobs of the core workforce is secure,” Volkswagen’s powerful works council chief Bernd Osterloh said at a news conference in Wolfsburg.

“We have agreed that forced redundancies are ruled out until end 2025. When I see what is going on at other companies, this is a big success in difficult times,” Osterloh said.

Volkswagen will build electric cars at its factories in Zwickau and Wolfsburg.

Electric motors will be built in Kassel, and VW will start battery cell production and development in Salzgitter.

Volkswagen will also build battery packs for electric and hybrid cars at its plant in Braunschweig, the company said.