London (CNN Business) The maker of Mercedes-Benz cars is spending billions on batteries as it accelerates the electrification of its product range.

Daimler said in statement on Tuesday it was spending €20 billion ($23 billion) on battery cells, and investing another €1 billion ($1.1 billion) in eight battery factories in Germany, China, Thailand and the United States.

The German carmaker wants to offer an electric or hybrid version of all its models by 2022, and it says the battery cell purchases will ensure a steady supply of essential components until 2030.

"We are systematically pushing forward with the transformation into the electric future of our company," Daimler CEO Dieter Zetsche said in the statement.

German automakers are investing heavily in new technology in a race for the future as tech companies and upstarts like Tesla ( TSLA ) plow money into electric and autonomous cars.