Step-by-step explanation:
The sun heats the earth through radiation. Since there is no medium (like the gas in our atmosphere) in space, radiation is the primary way that heat travels in space. When the heat reaches the earth it warms the molecules of the atmosphere, and they warm other molecules and so on.