Affective support from teachers—such as academic expectations, attention and care, and constructive feedback—plays a critical role in students’ learning outcomes but is often underexplored in large-scale educational assessments, particularly in developing countries. This study examines how Indonesian elementary students perceive teacher affective support and how these perceptions relate to their literacy and numeracy performance. Using data from the 2023 Indonesian National Assessment involving 214,481 fifth-grade students, we employed K-Means clustering to identify latent student profiles based on their literacy, numeracy, and self-reported perceptions of teacher support. Variables were normalized, and the optimal number of clusters was determined using the Elbow, Silhouette, and Davies-Bouldin methods. Five distinct student clusters emerged, each characterized by unique combinations of academic achievement and affective perceptions. High-achieving students consistently reported more positive perceptions of teacher support, particularly in terms of feedback and expectations. ANOVA tests confirmed significant differences (p 0.001) across clusters in all affective and academic variables, with moderate to large effect sizes. The findings highlight the alignment between academic success and perceived teacher affective support. This clustering approach reveals nuanced student profiles that traditional methods may overlook, offering a data-driven foundation for differentiated teaching, teacher training, and policy interventions. Clustering national assessment data provides actionable insights for enhancing affective support in classrooms. The methodology is scalable and adaptable for use in other educational systems seeking to personalize instruction and promote equity.