The main function of hemoglobin is delivering oxygen from the lungs to the peripheral tissues in the body.