Among the three mechanisms of heat transfer, sun uses radiation to heat the earth. There is no medium ( such as air or water) in space and hence the energy or heat can only be transferred through radiation. Once the sun's energy enters our atmosphere, it heats the molecules of air, which in turn transfer the heat to the neighboring molecules and so on. Once our ground surface is heated from the solar radiation, it starts emitting infrared emissions, much like a hot iron. These radiations are captured by our atmosphere and their escape from earth is delayed. This is the process that keeps the planet warm. Part of the solar radiation is also reflected back into the space by atmosphere, however the former process is dominant compared to reflection and hence earth stays warm.
Hope this helps.