And St Joseph’s College in Dumfries was second.
The schools’ positions are revealed in a new annual list published by The Times and based on Higher grade exam results.
Of Scotland’s 340 secondary schools, Moffat was the highest, listed in 24th place due to 62 per cent of students gaining five Highers.
St Joe’s was next in the 34th spot with 59 per cent gaining five of the qualifications, an improvement on their position last year, when they were 42nd.
Wallace Hall is another high achiever at 47th place, Dalbeattie is 90th and Langholm Academy came in at position 105 in Scotland and is number five in Dumfries and Galloway.
At the other end of the scale, the lowest placed school in the region was Sanquhar at 317th and Annan Academy was also languishing towards the bottom of the list at 281st as just 26 per cent of its senior students received five Highers.
Dumfries Academy sits 223rd nationally; Lockerbie Academy is 201; Dumfries High School was 155th and Castle Douglas was 131st.