Prime farmland has been granted national protection as the high-quality, stable, concentrated, and contiguous cultivated land farmland with high productivity. It is required to accurately demarcate the prime farmland for the effective protection of farmland and national food security. In this article, the research area was taken as the Xianyang City, Shanxi Province, China. Firstly, evaluation indicators were selected as the ecological value and policy conditions, according to the natural endowment, socio-economic conditions, and stability of cultivated land. A factor analysis was implemented to fully evaluate the cultivated land quality. Secondly, spatial clustering was introduced to combine the local spatial autocorrelation, in order to identify the spatial clustering or discrete features of cultivated land quality. The matrix combination was utilized to clarify the quality levels of cultivated land and spatial clustering characteristics of each region in pairs. Four protection zones were then designated to identify the continuous levels of the cultivated land using Buffer analysis. Finally, the connectivity and protection zones of cultivated land were screened and sorted, according to “priority to contiguous areas, good quality, and quantity constraints”. The prime farmland was classified to meet the requirements of the designated quantity constraints. The results show that: 1) The quality of cultivated land was divided into five levels: high, higher, general, lower, and low. More than half of the cultivated land shared the low and lower levels (35.81% and 29.67%, respectively). The proportion of high and general level cultivated land only exceeded 10%. The terrain and regional economic development were dominated by the spatial distribution characteristics under the different quality levels of cultivated land. The overall quality level of cultivated land also showed a spatial distribution pattern of "high in the south and low in the north". The cultivated land quality presented the outstanding spatial agglomeration with the primary types of high-high and low-low adjacency agglomeration. 2) Four protection zones of cultivated land were divided into priority protection, suitable protection, key remediation, and comprehensive governance zone. Among them, the largest area was the comprehensive governance zone with an area of 107 904.92 hm2, accounting for 35.50% of the total cultivated land area, whereas, the least area was the suitable protection zone, accounting for 11.81% of the total. 3) Six levels of contiguous cultivated land were divided into 49 713 contiguous cultivated land plots with an area of 289 033.61 hm2, accounting for 95.10% of the total arable land area. 4) The final demarcation of the prime farmland area was 266 420.85 hm2, accounting for 87.66% of the total cultivated land area. The key demarcation areas were distributed in Qian County, Jingyang County, Binzhou City, and Yongshou County, with a cumulative demarcation area accounting for 51.64% of the total demarcation prime farmland area. The findings can provide new ideas to optimize the layout of cultivated land, particularly for the next stage of prime farmland adjustment and demarcation. [ABSTRACT FROM AUTHOR]