Volcanoes erupt when magma from within the Earth's mantle rises to the surface. The magma is under tremendous pressure, and when this pressure becomes too great, it forces its way through vents and cracks in the Earth's crust, resulting in an eruption. The magma may also contain gases, such as water vapor and carbon dioxide, which can further increase the pressure and lead to explosive eruptions.