It is created deep beneath Earth's surface where temperatures get hot enough to melt rock.
Eventually, some magma makes its way to Earth's surface and escapes via a volcanic eruption. When magma erupts onto Earth's surface and begins to flow, scientists then call it lava.
Hope this helps!