Earthquakes are formed as 2 plates move towards eachother, one can be pushed down under the other one and into the mantle. If this plate gets stuck it causes a lot strain in the surrounding rocks. Sideways-moving plates can also get stuck. When this tension in the rocks is finally released it produces strong shock waves knowns as seismic waves. This is called an earthquake.