This study analyzes the relationships between cognitive appraisals, classroom and test emotions, and math achievement in a sample of 1219 Portuguese students from the 6th and 8th grades. Participants completed measures of perceived value, perceived competence, and seven math achievement emotions (boredom, hopelessness, anger, anxiety, enjoyment, pride, and relief) experienced in two different settings: classroom and tests. Math achievement was obtained from school records. Results showed significant associations between student competence and value appraisals, their emotional experiences in test and classroom situations, and their math achievement. However, when emotions were considered simultaneously in structural equation modeling, only anger in test situations and hopelessness were significant negative predictors of students’ math achievement. Hopelessness appears to play a particular role in the interplay between cognitive appraisals, emotions, and academic achievement as it is the only emotion that relates to math achievement both in test and classroom situations. Furthermore, findings also support the existence of differences in the relationships between cognitive appraisals and the achievement emotions students experience in these two settings.