(BBC)-- Germany's budget surplus hit a post-reunification high of nearly 24bn euros (£20bn) in 2016 boosted by a higher tax take and increased employment, reports The BBC.
This is the third year running that German government revenue has outstripped expenditure.
However, there was an increase in spending on housing and integrating refugees.
Under budget law, some of the surplus money will go into a fund to support the refugees.
Separately, official figures confirmed the economy grew by 1.9% last year, mainly because of higher spending by consumers and government.
The budget figures, published by Germany's Federal Statistical Office, showed that income was higher than spending in all areas of government - federal, state and local government, as well as social security.
The office said the main factors improving revenues were the large increase in income tax and property tax payments as well as the "good employment situation", which led to a "considerable growth" in social contributions.
In terms of expenditure, a big factor was increased spending by state and local governments on things such as accommodation for refugees, as well as payments to them for living expenses.
Germany has taken in more than a million migrants over the past two years, mainly from Africa and the Middle East.
The actual surplus figure of 23.7bn euros represents 0.8% of gross domestic product (GDP).
The federal government's share of the surplus amounts to 7.7bn euros, all of which will be paid into a fund to support refugees.
Chancellor Angela Merkel played down the new figures. "If you look at the federal level alone, the surplus is rather small," she said.
She said the government would increase spending on defence, as well as on domestic security and social improvements.
"At the same time, we don't want to take on new debt. So the room for manoeuvre is rather limited," she added.
The GDP figures showed that the German economy grew by 0.4% in the final quarter of 2016, primarily because of strong domestic demand.
As well as higher consumer spending, there was an increase in federal, state and local government expenditure.
Germany's economic strength has traditionally been bolstered by exports.
In the final quarter of last year, however "the development of foreign trade had a downward effect on growth", the Statistical Office said.
While exports of goods and services rose by 3.3% from a year earlier, imports increased by 4.5%.
Thursday's figures follow European Commission criticism of Germany's relative economic strength within the eurozone.
On Wednesday the Commission said Germany's current account surplus - which measures the balance of goods, services and investments into and out of the country - was too big.
It said that cutting that surplus would help the whole of the eurozone.
It also said Germans were saving too much and not investing enough in both the private and public sector.
The Commission acknowledged that steps had been taken to reverse that situation, but more could be done.
To address the economic "imbalances" the Commission said: "Further policy action should aim at further strengthening investment, including by reforming the services sector and improving the efficiency of the tax system, as well as stimulating labour market activity of second earners, low-income earners and older workers to boost households' incomes and counter the effects of ageing."