There are three primary phases of matter: solid, liquid and gas. A solid becoming liquid is called melting or fusion. A solid becoming gaseous is called sublimation. A liquid becoming solid is called freezing. A liquid changing to gas is called boiling or evaporation. A gas changing into a solid is called deposition, and a gas changing into a liquid is called condensation. Half of these are endothermic, meaning they absorb heat from their surroundings. The others are exothermic, meaning they release heat.
TL;DR (Too Long; Didn't Read)
Melting, sublimation and boiling are endothermic reactions -- one that consume energy -- while freezing and condensation are exothermic reactions, which release energy.
Endothermic phase changes take in heat from the surrounding environment; they include melting, sublimation and boiling. The forces that bind together the atoms and molecules of a given substance determine its melting and boiling points; the stronger the forces, the more heat energy is needed to overcome them. Once heat overcomes these binding forces, the atoms move about more freely, allowing liquids to flow and gases to evaporate. For example, the forces that hold iron atoms together are strong, so it takes high temperatures to melt iron. Butter, on the other hand, is held together by weak forces, so it melts at relatively low temperatures.
An exothermic phase change releases heat energy into its environment. These changes include freezing and condensation. When a substance loses heat energy, the attractive forces between atoms slow them down, reducing their mobility. For this to happen, heat must leave the substance, such as water turning into ice cubes in your freezer. In the same manner, at room temperature, heat leaves a pool of liquid iron, turning it solid.
Phase changes occur when a substance exceeds its melting or boiling temperature; at this point, additional heat energy added (or taken away) is used not to make the substance warmer (or colder) but for its atoms to change into the new phase. For example, at zero degree Celsius, heating up ice at standard pressure will not make warmer ice; the heat will be used to break the crystal structure of ice, transforming it into liquid water.
Pressure and Temperature
In addition to temperature, pressure also affects melting and boiling; high pressures drive phase change temperatures up, low pressures reduce them. This is why water boils at 100 degrees Celsius (212 degrees Fahrenheit) at sea level, but boils at lower temperatures at high elevations where the atmosphere is thinner.