Earthquakes occur when there is a sudden release of energy in the Earth's crust that creates seismic waves. This release of energy is typically caused by the movement of tectonic plates along faults in the Earth's lithosphere. When the stress along a fault exceeds the strength of the rocks holding it together, the rocks break and slip, resulting in an earthquake. The seismic waves generated by this movement travel through the Earth, causing the ground to shake.