School environments are thought to play an important role in the community spread of airborne infections (e.g., influenza) because of the high mixing rates of school children. The closure of schools has therefore been proposed as efficient mitigation strategy, with however high social and economic costs: alternative, less disruptive interventions are highly desirable. The recent availability of high-resolution contact networks in school environments provides an opportunity to design micro-interventions and compare the outcomes of alternative mitigation measures. We consider mitigation measures that involve the targeted closure of school classes or grades based on readily available information such as the number of symptomatic infectious children in a class. We focus on the case of a primary school for which we have high-resolution data on the close-range interactions of children and teachers. We simulate the spread of an influenza-like illness in this population by using an SEIR model with asymptomatics and compare the outcomes of different mitigation strategies. We find that targeted class closure affords strong mitigation effects: closing a class for a fixed period of time -equal to the sum of the average infectious and latent durations- whenever two infectious individuals are detected in that class decreases the attack rate by almost 70% and strongly decreases the probability of a severe outbreak. The closure of all classes of the same grade mitigates the spread almost as much as closing the whole school. Targeted class closure strategies based on readily available information on symptomatic subjects and on limited information on mixing patterns, such as the grade structure of the school, can be almost as effective as whole-school closure, at a much lower cost. This may inform public health policies for the management and mitigation of influenza-like outbreaks in the community.