Gravity is an attractive force between material bodies. The Earth has a great gravitational force, which is why all objects fall when thrown into the air.
The existence of celestial bodies is a result of the gravitational force, since it binds all material together, forming planets, for example. This force is also responsible for keeping the planets of the Solar System in their proper orbits, which move around the Sun. Also including that this force is responsible for the occurrence of the tidal cycle and influences other natural phenomena.
Earth's magnetism is the result of the movement of its core, which is believed to have a liquid and a solid part, made up of metallic iron alloys. Thus, what happens is an interaction between the liquid and solid parts, promoting the emergence of a strong magnetic field, which has its strength perceived even on the surface.
On Earth, the Magnetic South Pole attracts the Geographical North Pole, and the Magnetic North attracts the Geographical South Pole.
By Eduardo de Freitas
Graduated in Geography
Source: Brazil School - https://brasilescola.uol.com.br/geografia/gravidade-magnetismo-1.htm