The Teachers' Union (Lärarförbundet) has been producing the rankings annually for 16 years, and evaluated 13 different criteria to judge the schools. Some of the key factors in judging the municipalities included the proportion of qualified teachers to students, teachers' salary levels, and student grades.
"It does not measure everything but is a door opener for the important conversations that are necessary for the right decisions to be made and for giving school management, teachers and students the best possible conditions," said Johanna Jaara Åstrand, chairperson of the union.
She added that "any municipality can become the best school municipality - with the right decisions, investment and dialogue", pointing to the fact that many of the municipalities ranked in the top ten for this year had seen significant improvement compared to last year.
Vellinge in the Skåne region was judged as the best spot for schooling in the whole country, a position it has now held for four years in a row.
It was followed by Orust in Västra Götaland and Ovanåker in Gävleborg, both of which had soared up the rankings since last year, climbing from 42nd place and 52nd place respectively.
At the other end of the scale, Lessebo in Kronoberg, southern Sweden was ranked as the worst municipality in the country for schooling, dropping 38 places from 2016.
The biggest problem facing Sweden's state schools is a widespread teacher shortage which the government has pledged to address, the union said, noting that the shortage affected all of the country's municipalities.
Åstrand said three steps were necessary to tackle the shortage: higher wages for teachers, better working conditions, and greater confidence in teachers.
The ten best Swedish municipalities for schooling, according to the rankings:
And the ten worst:
6. Lilla Edet