The buildings of the banking district are reflected in the river Main in Frankfurt, Germany, Sunday, Jan. 29, 2023. AP
Europe's top economy contracted 0.2 percent in the October to December period compared to the previous quarter, according to preliminary figures from statistics authority Destatis.
Analysts from financial data firm FactSet had been expecting zero growth.
For the whole of 2022, the German economy grew 1.8 percent, said Destatis, revising down an earlier figure of 1.9 percent.
"After the German economy managed to perform well despite difficult conditions in the first three quarters, economic performance slightly decreased in the fourth quarter of 2022," Destatis said in a statement.
Consumer spending, which supported the economy in the first three quarters of 2022, slipped in the final three months, it said.
LBBW bank economist Jens-Oliver Niklasch said that the fourth quarter data "makes at least a short recession more likely".
This "would be in line with our forecast for 2023, which predicts a decline in economic output of half a percent for the year as a whole," he added.
Russia's invasion of Ukraine, and subsequent move to slash crucial gas supplies, triggered an energy crisis in industrial powerhouse Germany, and sent food and energy costs soaring.
But while growth at the end of 2022 was expected to be hit hard, the German economy appears to have weathered the crisis better than expected.
It was helped by government relief measures, including a cap on energy prices, a scramble to find alternative energy supplies as well as a relatively mild winter weather.
Last week, the government forecast that Germany would dodge a recession with growth of 0.2 percent in 2023 -- revising a prediction from a few months earlier that it would contract by 0.4 percent.