The tectonic plates are always slowly moving. However, they get stuck at their edges due to friction. Earthquakes are caused when the stress of the tectonic plates on the edge overcomes the friction. The quake then releases energy in waves that travel through the earth's crust and cause the shaking we feel.