Scotland's population reached an all-time high in 2011, boosted by net increases in immigration and the birth rate.
The General Register Office for Scotland estimated the population at 5,254,800, a rise of 32,700 against the previous year and topping the previous high point of 5.24 set in 1974.
The rise also exceeds the 24,000 increase which the Scottish Council of Economic Advisers said was necessary to meet Scotland's population growth target.
Edinburgh saw the biggest increase around the country, rising by 1.9 per cent, while at the other end of the scale Inverclyde saw a 0.7 per cent decline.
After three decades of decline, Scotland's population has taken an upturn in the first decade of the 21st century. The 2001 census recorded 5,062,011 people living in the country and as recently as 2003 the number was expected to drop below five million by 2010.
However, the last nine years have seen a continuous rise in the population and the latest increase is the highest for a single year in half a century.
A total of 42,300 people are estimated to have arrived in Scotland from overseas in 2011 while 16,900 left, a net rise of 25,400.
Migration within the UK showed a smaller net gain, with 43,700 people coming in from England, Wales and Northern Ireland compared to 40,800 going the other way.
Births outstripped deaths by the second highest margin in modern times, with an overall gain of 4800.
The Scottish Government wants wider-ranging powers over immigration to boost the working-age population by attracting more foreign workers.
A spokesman said: "The Scottish Government is working hard to promote Scotland as a positive place to live, work, study and remain. Today's statistics show Scotland's population is at its highest-ever level.
"This year's net population increase is the highest we have seen for more than 50 years and demonstrates that our hard work to grow Scotland's population to support economic growth is paying off."
- Scotland's population boost
- Large-scale immigration is not needed to save Scotland's population
- Population level at highest for 25 years