Scotland has seen an improvement in children's reading but has fallen behind other countries in maths, according to an international survey.

The data in the Programme for International Student Assessment (PISA) 2018 offers a mixed picture across three areas - reading, maths and science.

Education secretary John Swinney said improvements in reading were encouraging but acknowledged more work was needed in numeracy and science.

Opposition parties claimed the findings showed that pupils were being failed under the SNP government.

The report measures the performance of 600,000 15-year-olds across 79 countries. In Scotland, the data was gathered in 2018 across 107 schools and involving 2969 pupils.

When it was last published in 2016, the PISA assessment caused a political row when Scotland was classed as "similar to the OECD average" in all three subject areas for the first time.

Three years on, Scotland was above the OECD average in reading and similar to the OECD average in maths and science.

Scotland's own overall performance in 2018 compared to 2015 improved in reading and was similar in maths and science.

However, while Scotland's relative performance compared to other countries, including UK administrations, improved in reading and stayed similar in science it declined in maths.

Five out of 36 countries from the Organisation for Economic Co-operation and Development (OECD) recorded a higher achievement level than Scotland.

The report shows social background is now less of factor in performance and provides evidence that the attainment gap is closing.

Mr Swinney said: "These are very encouraging results and the latest sign that our education reforms are working.

"Scottish schools are improving and this international study confirms that.

"Reading underpins all learning, and the sharp rise in performance is good news."

He added: "The figures on social background also confirm that we are closing the gap between pupils from the richest and poorest backgrounds.

"Maths and science scores are stable at the OECD average, so we need to see the kind of improvement that we now see in literacy in these areas too. That is the challenge."

Liz Smith, Scottish Conservative education spokesperson, said: "This is damning evidence revealing the full extent of the SNP's shameful 12 years running down Scotland's schools.

"Nicola Sturgeon's obsession with a second divisive referendum has come at a high cost to our schools."

PISA is designed to assess pupils' skills in reading, mathematics and science.

Its main focus was reading, but the report also included questions on maths and science.

The international survey allows comparisons to be drawn with other countries around the world and enables each country to monitor education in a global context.

Willie Rennie said the results worst ever results for science and maths in the PISA international data.

He said: "John Swinney can't hide from these appalling results.

"Scotland used to have one of the best education systems in the world, but under the SNP it's now just average."

The EIS teaching union said the results showed a "solid performance overall".

It also said a narrowing attainment gap showed Scotland's comprehensive system "offers greater equality of opportunity to pupils from all backgrounds".

EIS general secretary Larry Flanagan said: "There is a lot of rich data in PISA 2018 which will require time for proper analysis.

"It is clear, however, that Scottish education is actively working on the key elements identified by the OECD as necessary for continued improvement - tackling the impact of deprivation on educational attainment, ensuring high standards of teaching, and being concerned about pupil well-being."