Sketch of a magma reservoir beneath a volcano and a conduit leading up to a lava dome at the surface. Arrow indicates direction of magma movement from a deeper source. Credit: B. Myers / U.S. Geological Survey.
Magma is molten rock in the interior of the Earth (or some other planet or moon), composed of a mixture of various complex silicates in which are dissolved various gaseous materials, including water vapor. If it reaches the surface it is known as lava; upon solidifying it forms igneous rock.
Magma typically consists of (1) a liquid portion (often referred to as the melt); (2) a solid portion made of minerals that crystallized directly from the melt; (3) solid rocks incorporated into the magma from along the conduit or reservoir, called xenoliths or inclusions; and (4) dissolved gases.
Magma that cools and solidifies within the crust may form either plutonic (at great depths) or hypabyssal (at intermediate depths) rocks.