An earthquake occurs when there is a sudden release of energy in the Earth's crust that creates seismic waves. This release of energy is usually caused by the movement of tectonic plates, which are large sections of the Earth's crust that float on the semi-fluid mantle below.
When two tectonic plates are moving against each other, they can become stuck due to friction. As the plates continue to move, the stress and pressure build up until they are suddenly released in the form of an earthquake. This release of energy causes the ground to shake and can result in damage to buildings, infrastructure, and the environment.
Earthquakes can also be triggered by other factors, such as volcanic activity, landslides, or human activities like mining or reservoir-induced seismicity. The severity of an earthquake is measured on the Richter scale, which quantifies the amount of energy released by the earthquake.