An earthquake was reported shortly before midnight in South Wales last night - but what actually causes an earthquake?

The UK's main provider of earthquake data, the British Geological Survey (BGS) confirmed the tremor on Saturday morning in a statement. 

BGS shared alongside a seismic activity alert: "BGS has received reports from residents throughout the region, mainly from within around 40km of the epicentre.

"Reports described "the whole house was shaking", "the rumbling and the bang woke me up", "my bed seemed to move side to side", "was like a large explosion".

The earthquake data provider reported that the quake was of a 3.7 magnitude and occurred at a depth of 3.6km. 

Meanwhile, Google's Android Earthquake Alerts System recorded the tremor as a 4.2 magnitude.

Although, it might sound surprising but the UK actually experiences hundreds of tremors every year but most are simply not strong enough to feel.

There are approximately 20 to 30 earthquakes that can be felt by Brits each year, according to the BGS.

However, there are hundreds of smaller ones that are recorded by sensitive instruments.

What causes earthquakes?

Earthquakes are caused by sudden movements under the earth, BGS has explained. 

On its website, it added: "The movement releases stored-up ‘elastic strain’ energy in the form of seismic waves, which propagate through the Earth and cause the ground surface to shake.

"Such movement on the faults is generally a response to long-term deformation and the buildup of stress."

Seismic waves also give us an insight into how the Earth is composed since their speed depends on density.

Observing the travel time of the waves lets us see a change in depth and understand that the Earth is made up of several layers.

The planet's outermost layer is broken up into 15 major slabs called tectonic plates.

The tectonic plates move very slowly relative to each other around a few centimetres per year, BGS estimates.

READ MORE: How many earthquakes have hit the UK as South Wales records midnight tremor?

READ MORE: Was there an earthquake last night? South Wales hit by midnight tremor

However, this is enough to cause a huge amount of deformation at the plate boundaries which lead to earthquakes.

Scientists have used observations to conclude that most earthquakes are associated with tectonic plate boundaries.

Since the UK does not sit on a fault line between tectonic plates, the majority of earthquakes experienced in the UK tend to be small and cannot be felt.

Read more about what causes earthquakes via the British Geological Survey website.

How are earthquakes detected and measured?

Earthquakes are detected using seismograph or seismometer which is a measuring tool that records the ground motions caused by seismic waves from an earthquake. 

BGS has explained that the seismograph converts vibrations from seismic waves into electrical signals, which we can then display as seismograms on a computer screen.

This data is then used by Seismologists to study earthquakes and determine where and how big a particular earthquake is.

When it comes to measurement, two of the most common scales used by seismologists are intensity and magnitude. 

The UK uses the European Macroseismic scale (EMS) to understand the effect of earthquake shaking on people, objects and buildings.

Meanwhile, for magnitude, earthquake scientists have developed a number of different scales with the most famous being the Richter scale. 

"The most standard and reliable measure of earthquake size is moment magnitude (Mw), which is based on seismic ‘moment’," experts at BGS said.

They added: "A Moment is related to the area of the earthquake fault rupture and the amount of slip on the rupture, as well as the strength of the rocks themselves."