More school leavers have five Highers
More than 30% of Scottish students left school with at least five passes at Higher last year - the highest proportion ever recorded.
A new report shows that young people were generally staying in school longer and gaining more qualifications.
Deputy First Minister John Swinney called the findings "encouraging".
The Scottish Conservatives said the increase in Higher passes was a "good thing" but there was no sign of the attainment gap narrowing.
The official figures were released as part of the School leaver attainment and initial destinations: statistics.
It shows the gap between those from the most and least deprived areas achieving one pass or more at Higher Level or better decreased slightly, to a record low.
However, this was not the case at National 4 and National 5 levels where the attainment gap grew.
Other key findings include:
- The number of pupils taking up work, training or further study within three months of leaving school has increased. A total of 94.4% of 49,748 leavers did so in 2017-18 - up from 93.7% of 51,300 in the previous year.
- More young people are also choosing to remain at school, with almost two thirds leaving in S6.
- An increasing proportion of school leavers are going into higher education - from 36.2% in 2009/10 to 41.1% last year.
- There is a drop in those going to training, with just 2.1% following that route last year, down from 5.1% nine years go.
The figures also indicated that the gap between those from the most and least deprived communities going onto work, training or study has halved since 2009-10.
In 2009, the total number of pupils from the most deprived areas in Scotland going on to work, training or study stood at 78.8%. The latest figures show this has risen to 90.4%.
Mr Swinney said the statistics showed "real world progress in tackling an age old problem".
"I am particularly pleased to see the attainment gap between school leavers achieving a pass at Higher level or better is at a record low," he added.
But the gap in attainment at Higher level remains stark.
In 2016/17, 43% of those young people in the most deprived communities passed at least one Higher, compared with 80.6% in the least deprived.
The gap narrowed by 0.2 percentage points last year, as 44.4% of those from deprived areas gained one Higher or more against 81.8% of students in the least deprived area.
At SCQF levels 4 and 5, the gap increased slightly, from 5.9 to 6.1 percentage points and from 19.3 to 20.3 percentage points respectively.
Mr Swinney said the government was investing more than £180m through the Scottish Attainment Challenge in 2019/20 to help address the issue.
"The figures published today are encouraging, but we know there is more to do to raise attainment and ensure all our young people have the very best chance to build the knowledge, skills and confidence they need to succeed, regardless of their background," he said.
Scottish Conservative education spokeswoman Liz Smith said: "These figures show some encouraging signs most especially in terms of an increasing number of pupils with more qualifications at both Higher and Advanced Higher. This has to be a good thing.
"However, the figures also show that, as yet, there is no sign of the attainment gap narrowing.
"It is still the case that the odds are stacked against those pupils in deprived areas compared with their counterparts from better off communities."
Scottish Labour education spokesman Iain Gray said the figures indicated a "class divide" in the country.
He said: "In Scotland today, young people from the most deprived areas are more likely to go to college and less likely to go straight to university after school."
Meanwhile, campaigners noted that more students with additional support needs (ASN) were among those ending up in positive destinations.
But they also noted that the rise had not kept pace with the improving performance generally in recent years.
A spokesman for the Scottish Children's Services Coalition said: "While we are therefore seeing the attainment gap closing between those with ASN and no ASN, in terms of those entering positive destinations the gap is widening.
"More support and guidance is required to ensure that those transitioning from a school environment are able to enter a positive destination and thereby achieve their full potential."