Society recognises the importance of agriculture to supply goods, which are essential for human survival and well-being. Sustainable agriculture is an important goal since resources need to be preserved for future generations. The recent agricultural policy orientations towards environmental concerns have also had consequences for Portuguese agriculture. The information provided by the 2019 Agricultural Census offers an opportunity to analyse the recent dynamics and establish rankings of municipalities related to agricultural sustainability. Sustainability in agriculture can be studied using different types of indicators, but its quantification and aggregation into an index is still difficult. This paper proposes an approach based on compromise programming to analyse sustainability considering the dynamics between the 2009 and 2019 Agricultural Census. This approach has three main steps: in the first one, the indicators are selected and a HJ-Biplot and Cluster analysis are carried out to identify groups of municipalities and general dynamics; in the second step, the weights of indicators are defined, and a novel compromise programming model is implemented to define the rankings of sustainability for each year; finally, in the third step, the spatial dynamics of the sustainability rankings are analysed and classified into the clusters of municipalities previously created. The analysis was implemented using data from the 308 Portuguese municipalities for 12 individual indicators encompassing the several dimensions of sustainability. The results were promising since the approach allowed for the identification of the main dynamics and tendencies regarding sustainability.