Heat is the flow of energy from a high temperature to a low temperature. When these temperatures balance out, heat stops flowing, then the system (or set of systems) is said to be in thermal equilibrium. The zeroth law of thermodynamics uses thermal equilibrium to define how two different systems can be said to be at the same temperature. For example, when molten rock comes up from a volcano, it will give off heat to the atmosphere until the rock and the atmosphere are at the same temperature. Even though the two systems (rock and air) are very different, thermal equilibrium allows a definition of temperature for both.
All systems tend towards thermal equilibrium over time—and some systems will take a lot longer than others. Knowing that interacting systems will tend towards the same temperature allows for important applications in all areas of science. For example, the specific heat capacity of a substance can be determined by placing it in water and measuring the temperature after a period of time.
It is very important for the Earth to remain in thermal equilibrium in order for its temperature to remain constant. The incoming solar energy to the Earth must be balanced—meaning the Earth must radiate just as much as heat as it receives. The greenhouse effect slows down the heat transfer from Earth to space, making the planet hotter. The temperature of the Earth relies on the natural greenhouse effect in order to be habitable by humans and other animals and without it, the Earth would be far too cold. However, the increase of carbon dioxide, methane and nitrogen dioxide in the atmosphere is increasing this greenhouse effect, causing slightly less heat to be let out of the Earth than is absorbed in Earth's energy flows. This slight imbalance from equilibrium is leading to a warming climate which is changing the planet in dangerous ways.