Surfactant is a complex mixture of lipids and proteins produced by the alveolar cells in the lungs. Its primary function is to reduce surface tension within the alveoli, preventing their collapse during exhalation. This is crucial for maintaining proper lung function, especially in newborns who are still adjusting to breathing air for the first time.