Earthquakes occur when there is a sudden release of energy in the Earth's lithosphere, which causes seismic waves to shake the ground. This release of energy is usually due to the movement of tectonic plates along faults in the Earth's crust. The stress that builds up between the plates is released in the form of seismic waves, resulting in an earthquake.