The institution remains number one in Scotland but has dropped from third place in 2018 to fifth place in the Complete University Guide 2019 rankings.
It comes behind Cambridge, Oxford, London School of Economics and Imperial College London in the guide, published today.
Other Scottish universities in the UK top 50 include Edinburgh in 23rd place and Glasgow in 24th, while Aberdeen has risen 12 places to be ranked 28th.
Dundee comes in 31st place while Strathclyde and Stirling are ranked 40th.
The Complete University Guide 2019 rankings are based on ten measures, including student satisfaction, research, entry standards, the proportion of good honours degrees awarded, graduate prospects and completion rates.
For the third year running, TheCompleteUniversityGuide.co.uk has published a ranking of specialist arts, drama and music institutions, with 13 colleges and conservatoires.
The Royal Conservatoire of Scotland has moved up five places to second place.
In separate listings covering 70 subjects, only five universities come top in more than two subjects.
The University of Strathclyde leads in seven, the University of Glasgow in five and St Andrews in three.
St Andrews said it had ranked top in Scotland since the guide was first published 11 years ago and welcomed the latest table.
The university’s Principal Professor Sally Mapstone said: “It’s an honour to be top in Scotland after another very strong performance from the sector north of the border.
“St Andrews’ values are those of a small, Scottish, and highly international university. We are outward looking, inclusive and focused on excellence.
“We see teaching quality and research excellence as commensurate, and we provide them in an environment that is beautiful, friendly and enriching.
“This is an encouraging result for St Andrews, and for Scottish higher education which continues to show its strengths.”
The authors of the table also note that throughout all parts of the UK the number of students graduating with either a first-class or upper second-class honours degree has increased year-on-year since it was first created.
Dr Bernard Kingston, chairman of TheCompleteUniversityGuide.co.uk, said: “The proportion of good honours has steadily but inexorably increased at almost all universities.”