While expectancy‐value‐cost theory predicts that students’ task values play an important part in academic engagement, these associations have rarely been tested in science education and are even less studied in authentic classroom situations. The present study examined to what extent momentary task‐values, expectations and costs are associated with students’ momentary academic engagement in science classes. Momentary academic engagement was operationalised as energy (give up), dedication (grit) and absorption (flow) components of engagement. Finnish (N = 5891 beeps, 307 students) and Chilean (N = 1931 beeps, 157 students) secondary school students participated in the study using Experience Sampling Method via smartphones. When signalled, students responded to questions via smartphones concerning their momentary task values, expectations, costs and components of engagement in the current activity. The research questions were analysed with multilevel path modelling. The results showed that, for both samples task‐values, expectations and costs were related to energy, dedication and absorption components of engagement in science classes. High momentary task‐values were positively associated with momentary flow and grit; high momentary expectations were positively associated with high grit and low giving up in both samples; and high momentary challenge showed as increases in feelings of giving up.