Viscosity is defined as the ability of a substance to resist flow, which means the inverse of fluidity. A magma's viscosity is controlled by its temperature, composition, and gas content.
The viscosity of the magma is important in determining whether an eruption will be explosive or nonexplosive. A low-viscosity magma will allow the escaping gases to migrate rapidly through the magma and escape to the surface. However, if the magma is viscous it will slow the upward mobility of the gas bubbles, thus increasing the overall pressure on the magma column until the gas ejects explosively from the volcano.