In high transmission settings, most school-aged children harbour malaria parasites without showing symptoms, often leading to anaemia and possibly impaired psychomotor and cognitive abilities. We aimed to assess the effectiveness and safety of intermittent preventive treatment for malaria in school-aged children (IPTsc) living in highly endemic areas. We did an open-label randomised controlled trial in seven primary schools in northeastern Tanzania. Schoolchildren aged 5-15 years were individually randomly assigned (1:1:1) to receive dihydroartemisinin-piperaquine, artesunate-amodiaquine, or standard of care (control) using a balanced block design. Drugs were administered by schoolteachers, with supervision from study nurses, at months 0 (baseline), 4, and 8, and were given in line with manufacturer's recommendations with dose based on the child's bodyweight. The primary endpoints were change from baseline in mean haemoglobin concentration at months 12 and 20, and clinical incidence of malaria and prevalence of parasitaemia at months 12 and 20 in the intervention groups versus the control group. The outcome data were collected through longitudinal surveys conducted every 4 months. Data were analysed on the basis of intention to treat (including all randomised participants) and per protocol (comprising children who completed the full 3-day regimen of all three IPTsc treatment rounds as assigned). This study is registered with ClinicalTrials.gov (NCT03640403). Of the 1797 children scheduled for clinical screening, 1566 were enrolled and randomly allocated (526 to receive dihydroartemisinin-piperaquine, 527 to receive artesunate-amodiaquine, and 513 to receive standard of care). Due to COVID-19-related school closures, only two schools were visited at month 12 (135 children in the dihydroartemisinin-piperaquine group, 131 in the artesunate-amodiaquine group, and 118 in the control group). At month 12, compared with the control group, the change from baseline in mean haemoglobin concentration was increased by 0·5 g/dL (95% CI 0·2 to 0·8; p<0·0001) in the dihydroartemisinin-piperaquine group and 0·5 g/dL (0·2 to 0·7; p=0·0020) in the artesunate-amodiaquine group in the intention-to-treat analysis (with similar findings in the per protocol analysis). In the same period, in the intention-to-treat analysis, the prevalence of malaria parasitaemia increased from 28·5% (138 of 485 participants) to 33·6% (39 of 116) in the control group, but decreased from 28·0% (139 of 497) to 12·0% (15 of 125) in the dihydroartemisinin-piperaquine group (-21·6 percentage points [95% CI -31·9 to -11·3], p=0·0001 vs control at month 12) and from 24·7% (124 of 502) to 16·0% (20 of 125) in the artesunate-amodiaquine group (-17·6 percentage points [-28·4 to -6·9], p=0·0015). The decrease for artesunate-amodiaquine was larger in the per protocol analysis (-25·3 percentage points [-36·3 to -14·2], p<0·0001). The protective effect of IPTsc against malaria parasitaemia was 64% (95% CI 39 to 79; p<0·0001) for dihydroartemisinin-piperaquine and 52% (23 to 70; p=0·0015) for artesunate-amodiaquine in the intention-to-treat analysis, and was slightly higher on per protocol analysis. The protective effect against clinical malaria at month 12 was 20% (95% CI 9 to 29; p=0·0002) for dihydroartemisinin-piperaquine and 19% (8 to 28; p=0·0004) for artesunate-amodiaquine. No significant differences in any primary outcomes between the intervention and control groups were noted at month 20. Dihydroartemisinin-piperaquine and artesunate-amodiaquine were associated with a small number of mild adverse events, and there were no treatment-related serious adverse events or deaths. IPTsc with dihydroartemisinin-piperaquine or artesunate-amodiaquine is a safe and effective approach to reducing malaria parasitaemia, clinical malaria, and related morbidities, and is feasible to implement through programmes delivered by schoolteachers. Flemish Interuniversity Council (VLIRUOS), EU EDCTP2 programme (MaReCa project), and Global Minds 2019. For the Swahili translation of the abstract see Supplementary Materials section.