Scotland is the most highly-educated country in Europe and among the best-educated in the world, according to UK statisticians.

More than two-fifths of people aged 25-64 in Scotland are educated to tertiary level, outstripping Ireland, Luxembourg and Finland at the top of the table, a new regional compendium by the Office for National Statistics (ONS) has revealed.

The rest of Europe - including the UK as a whole - falls below two-fifths, with Italy and Romania the lowest, with only a sixth of the population educated to a high level, according to the ONS.

Scotland is also up with Canada and Russia among the most well-educated countries in the world.

The compendium has been produced to inform the referendum campaign and contains raft of figures on population, migration, economy and society.

Launching the compendium in Edinburgh, ONS chief economic adviser Joe Grice said: "The purpose of the compendium is to place where we can comparable information about the four countries in the UK to bring together a resource to support public debate.

"Obviously in the context of Scotland it would be unrealistic to ignore the fact that there is a little referendum going on here which is relevant too."

He added: "In terms of the proportion of the population going into higher and tertiary education, Scotland actually has just about the highest in the world.

"Scotland also does very well in terms of people in the working-age population (16-64) that have got a qualification at NVQ4 or above.

"Both of those are quite strong indications of a skilled workforce in Scotland.

"At the other end of the scale, the proportion of people of working-age population with no qualifications is highest in Northern Ireland (17.2%), Wales (10.6%) and Scotland (10.3%) not dissimilar and England (9.1%) a bit below that.

"So, at the other end of the scale, Scotland doesn't come out quite at the same top-of-the-class way as the other two indicators.

"There is some pretty powerful evidence here."

The compendium also includes figures on "the Scottishness of Scotland", revealing that national identity is stronger north of the border, with over four-fifths (83%) declaring their national identity as Scottish, compared with 70% in England and two-thirds (66%) in Wales.

Roma Chappell, ONS deputy director of analysis, said: "We show the Scottishness of Scotland with 83% identifying themselves as either Scottish or Scottish and something else, stating some degree of Scottishness in their national identity.

"That's higher than the 70% in England and 66% in Wales, but nearly 22% of Wales are people living in Wales but not born there."

Scotland fell short of its target of attracting 24,000 additional immigrants to support pensions in 2012, with only 14,000 additional immigrants arriving.

Ms Chapell added: "In Scotland, after 2032 there has to be net migration to make up for the fact that the number of deaths exceeds the number of births.

"This is also the case for Wales from 2034 and Northern Ireland from 2036. It doesn't happen for England."

Scotland contributes less to the UK economy than its population share, excluding North Sea oil, with 7.8% gross value added (GVA) from 8.3% of the population, compared with 86.5% in England, which has 84% of the population, although most of its productivity is generated in London

Scotland has the lowest unemployment rate (6.4%) of the four UK countries and the second-lowest level of public-sector employment at 22.1% compared with 17.4% in England.

But Scotland has the second-highest public spending of all UK nations and regions, behind Northern Ireland, which spends a lot on public order and safety.

Scotland has a relatively higher public spending on economic affairs, such as support for businesses and health, than the other UK nations.

Commenting on the shortfall in immigration projections, Conservative MSP Alex Johnstone said: "These latest figures show that the SNP has got it badly wrong on immigration.

"They refuse to believe Scots hold similar views to the rest of the UK on the issue, even though polling has backed this up.

"Yet again, Alex Salmond has plucked a figure out of thin air, then used it to underpin an entire economic case.

"That is an irresponsible and chaotic approach to the independence debate."