Volcanic eruptions can be explosive, sending ash, gas and magma high up into the atmosphere, or the magma can form lava flows, which we call effusive eruptions. Whether an eruption is explosive or effusive largely depends upon the amount of gas in the magma.
If a magma has a lot of gas which becomes trapped in the magma, the pressure will build and build until eventually the magma erupts explosively out of the volcano.
It's a bit like a bottle of fizzy soda. Gas is trapped in the liquid, but if you shake the bottle the gas wants to escape. This builds pressure inside the bottle, and when you release the pressure by opening the bottle, the gas rushes out the top carrying some of the liquid with it.
Phreatomagmatic eruptions are a type of explosive eruption that results from the magma erupting through water. The second phase of the Ejyafjallajökull eruption in 2010 was phreatomagmatic as a result of magma erupting under the ice.
Some submarine volcanoes are phreatomagmatic, if the magma is gas-rich. For example Surtsey in Iceland. This eruption formed a new island.
If a magma has low viscosity (it is runny), gas can escape easily, therefore, when the magma erupts at the surface, it forms lava flows. These eruptions are gentle effusive eruptions.
If a magma rises very slowly within the conduit. or throat of the volcano, all the gas can escape. When the magma is viscous (or sticky), it can't flow when it reaches the surface, so it builds up forming a lava dome.