Scotland scores ahead of other UK countries in core school subjects, according to a major world study.

The international survey of 15-year-olds puts Scotland above England, Wales and Northern Ireland for reading and maths.

But for science, Scotland was marked slightly behind England.

The Programme for International Student Assessment (Pisa) ranks 65 countries. The UK was rated 26th for maths, 23rd for reading and 21st for science.

It is the first time the UK average score has not been ranked in the top 20 in any subject.

READING TOP 10 1. Shanghai 570

2. Hong Kong 545

3. Singapore 542

4. Japan 538

5. South Korea 536

6. Finland 524

7. Ireland 523

8. Taiwan 523

9. Canada 523

10. Poland 518 Source: OECD

Scotland does not have its own ranking, but the survey compares the performance of countries which are part of larger states.

The research, based on 500,000 pupils around the world, is run by the Organisation for Economic Co-operation and Development (OECD), using a points system.

For maths, Scotland scored 498 points, four higher than England, which was second in the UK.

For reading, the country scored 506 points, six higher than England.

Scotland scored 513 points for science, behind England, which scored 516.

Wales performs worst across the three subjects, the research shows.

The tables are based on data from 510,000 students across the participating countries in 2012.

MATHS TOP 10 1. Shanghai 613

2. Singapore 573

3. Hong Kong 561

4. Taiwan 560

5. South Korea 554

6. Macau-China 538

7. Japan 536

8. Lichtenstein 535

9. Switzerland 531

10. Netherlands 523 Source: OECD

China tops the league which is dominated by countries from the Far East.

The UK's average score for maths was 494 and in reading it was 499, broadly the same as the OECD averages for the subjects and putting the country on a par with nations such as the Czech Republic, France, and Norway.

The OECD concluded that across all three subjects the UK's average performance in maths has remained unchanged since the Pisa tests in 2006 and 2009.

The Scottish government said the "attainment gap" between the most advantaged and most disadvantaged pupils had narrowed for the first time.

They also pointed out that the survey was conducted before the new Curriculum for Excellence was fully implemented.

Learning Minister Alasdair Allan said: "Scottish school attainment remains strong, particularly in science and reading.

"We are performing at least as well as a number of significant world economies across all three areas, reinforcing our international standing in education.

"There is also clear evidence that the attainment gap is being addressed with a reduction in the variation in performance between those pupils classed as disadvantaged and those who aren't."

Kenneth Muir, chief executive of the General Teaching Council for Scotland, said Scotland's teachers were performing well in "a challenging environment".

He said: "As the professional body for teaching we know that the quality of teachers working in our schools is high and that the probationer teachers coming into the profession each year are some of the best we have experienced. This is hugely positive for the future of Scottish teaching."

Mr Muir added: "Ultimately, league tables such as these do not show the hard work and skill that goes into teaching children and young people and it is important that the commitment of Scotland's teachers does not go unrecognised."