Deep within the Earth's core there is abundance of magma. When this magma comes to the surface of the planet as in a volcanic eruption, it is called lava. Both magma and lava are forms of molten rock. There are three main processes by which rock can be melted into magma.
When tectonic plates under the Earth's surface shift, they create space between them. Hot rock under these plates then rises to occupy the space. As the rock rises, the pressure placed on the rock decreases and causes the rock to melt. This process occurs at the Mid-Ocean Ridge, an underwater mountain system.
Introduction of other elements
Chemical elements with relatively low boiling points are called "volatiles." Water and carbon dioxide are both volatiles, and when introduced with other elements they can lower the boiling points of those elements. If water is introduced to the hot rock under the Earth's surface, then it will cause the rock to melt at lower temperatures, thus producing molten magma.
When to things of different temperature come into contact with each other, heat is transferred from the hotter object to the cooler one in a process called "conduction." Rock can melt via conduction by coming in contact with other molten rock. As magma rises past solid rock, it is often hot enough to melt the rock it touches.
Magma typically forms in the Earth's Mantle, below the crust but above the core. Magma can be composed of many types of rock, and tends to rise due to the pressure caused by heat and the fact that liquid rock weighs less than solid rock. These are the forces that cause molten rock to erupt from volcanos as lava.