The increase is the largest seen in any census period since 1951, with migration given as the main factor.
While 73% of the population was born in Wales, 5% were born outside the UK, up from 1% in 2001.
The number of English-born people in Wales has also risen slightly over the past decade to 21%.
A total of 93,600 people born overseas moved to Wales between 2001 and 2011. However Pete Stokes, statistical design manager with the Office of National Statistics, said most "foreigners" in Wales were born in England.
He explained: "Out of a group of 20 people, 15 would be born in Wales, four in England and one elsewhere in the world."
He said the ethnic mix had not changed much since the previous survey. Wales is the least ethnically diverse area among the areas covered by the census, which also includes the English regions with 93% classing themselves as white, down from 96% in 2001.
Cardiff is the only local authority area where more than 10% of the population were born outside the UK. It also has the highest proportion of ethnic minority people at 20%.
A total of 1.36% of people living in Cardiff were born in India. Throughout Wales, 2.2% of people were of Asian origin, 0.6% of African, Caribbean or other black heritage and 1% of mixed ethnic origin.
Over 67,000 were from other EU countries including 12,000 from Ireland, and over 100,000 were from other parts of the world including Australia, New Zealand and South Africa.
There were more women at 1.6m, against 1.5m men.
Nearly one in five, or 563,000 people, were over the age of 65, a higher proportion than in England.
All areas of the country saw population growth except for Blaenau Gwent, which is also the county where most Welsh-born people live.
Glen Watson, director general of the ONS said: "It points to a growing picture of diversity and change in Wales."
The population of Wales has risen by 5% to 3.1m from 2001 to 2011, figures from the latest census have shown.