BERLIN - Trade between Germany and China rose to a record level last year, making the Asian country Germany's most important trading partner for the seventh year in a row despite political warnings in Berlin about excessive dependence.

Goods worth around 298 billion euros ($320 billion) were traded between the two countries, up around 21% from 2021, according to data from the German statistics office made available first to Reuters on Wednesday.

In 2022, Germany imported goods worth 191 billion euros from China, a third more than in 2021. Exports of German goods to China increased by only 3.1% to around 107 billion euros.

Overall, Germany had a trade deficit with China of around 84 billion euros.

"China is important as an export market, but far less important than it appears in the public perception," said Max Zenglein, chief economist at the Mercator Institute for China Studies (Merics). The United States is much more important for German exporters than China, Zenglein said.

Some German politicians and scientists are alarmed at the interdependence of the two countries in some areas, given their sharply different views on social and political freedoms.

The main problem is Germany's dependence on China for critical raw materials, which are needed for the transition to cleaner energy and transport, Lukas Menkhoff, head of the global economy department at the German Institute for Economic Research (DIW), told Reuters.

Germany imports about two-thirds of so-called rare earth metals from China. The metals are indispensable in batteries, semiconductors, and magnets in electric cars.

"Russia's war against Ukraine has dramatically shown us how commodity dependence can be used as political leverage by autocratic regimes," Menkhoff said. "Should China attack Taiwan, the German economy could run into supply problems."

The German Ministry of Economics is planning extensive requirements for German companies doing business with China and the exclusion of suppliers from authoritarian states from critical infrastructure.

($1 = 0.9313 euros)

(Reporting by Rene Wagner Writing by Maria Martinez Editing by Mark Potter)