Its main function is to control body temperature. As the water in the sweat evaporates, the surface of the skin cools.