The respiratory exchange system of insects must maximize the flux of respiratory gases through the spiracles of the tracheal system while minimizing water loss. This trade-off between gas exchange and water loss becomes crucial when locomotor activity is increased during flight and metabolic needs are greatest. Insects that keep their spiracles mostly closed during flight reduce water loss but limit the flux of oxygen and carbon dioxide into and out of the tracheal system and thus attenuate locomotor performance. Insects that keep their spiracles completely open allow maximum gas exchange but face desiccation stress more quickly. Experiments in which water vapor was used as a tracer gas to track changes in the conductance of the respiratory system indicated that flying fruit flies minimize potential water loss by matching the area of the open spiracles to their gas exchange required for metabolic needs. This behavior maintained approximately constant pressure for carbon dioxide (1.35 kilopascals) and oxygen (19.9 kilopascals) within the tracheal system while reducing respirometric water loss by up to 23% compared with a strategy in which the spiracles are held wide open during flight. The adaptive spiracle-closing behavior in fruit flies has general implications for the ecology of flying insects because it shows how these animals may cope with environmental challenges during high locomotor performance.