Volcanic eruptions occur when magma builds up beneath the Earth's crust and forces its way to the surface. Natural vents in the crust allow magma passage to the surface, and eruptions occur when the magma that forms is less dense than the material above it, causing it to flow upward. In some cases, this flow is slow and steady, but it can also be rapid and violent.
Explosive eruptions occur when pressure builds up in magma chambers beneath volcanoes. This is often due to different types of magma mixing in the chambers. Lighter, less-dense magma naturally rises, but if a bubble of lighter magma builds beneath a more dense, viscous reservoir of magma, the pressure can build up inside the chamber. Eventually, it becomes enough to force the heavier magma through the volcano's vent, causing an explosive eruption.
An eruption can also occur due to a collapse of the cinder cone of the volcano. Over time, lava flowing out of a volcano builds up more and more rock around the vent, and in some cases, that rock may become unstable. If enough collapses into the vent to block it and prevent magma and gases from reaching the surface, the pressure can build up to the point of explosive eruption.