Spirometry measures the flow and volume of air entering and leaving the lungs. It is used to assess ventilatory function and differentiates between normality and diseases causing obstructive and possibly restrictive defects.