The molten rock material that originates under the Earth's crustand forms igneous rock when it has cooled. When magma cools and solidifies beneath the Earth's surface, it forms what are known as intrusive rocks.
When it reaches the Earth's surface, itflows out as lava and forms extrusive (or volcanic) rocks.