Sunlight passes through the atmosphere and warms the earth's surface.
Heat rising from the surface in turn warms the atmosphere. Certain gases in the atmosphere absorb some of this heat and reflect it back to earth. Certain gases in the atmosphere, acting like the glass in the greenhouse allow solar light to pass through and warm the surface, but trap and retain the heat that results from the solar warming. This greenhouse effect is essential to our survival. Without it, the average surface temperature of the earth would be about 61 degrees F colder than it is today.