The figures highlight Germany's growing reliance on foreign-born workers to drive its powerhouse economy, Europe's largest, as well as its acceptance of hundreds of thousands of refugees.
Many of the immigrants came from other European Union countries, such as Poland, Romania, Italy, Bulgaria and Hungary.
Last year, the number of people living in Germany of a migrant background had risen by around 1.5 million, or 10 percent, from 2011. The native population -- excluding people of a migrant background -- fell by 1.4 percent.
The figures were based on a sample census, the Statistics Office said. It has been tracking migration numbers since 2005.
The release of the report comes as tensions are rising in Germany over surging numbers of refugees, expected to more than double to a record 450,000 this year from 200,000 in 2014.
An opinion poll last week found support falling for the government's pro-refugee policies.
There were 150 arson or other attacks that damaged or destroyed refugee shelters in the first six month of 2015 as Germany struggles to cope with refugees fleeing war and violence in the Middle East, Asia and Africa.
(Writing by Paul Carrel; Editing by Robin Pomeroy)
© Thomson Reuters 2015 All rights reserved