The geomagnetic field is our natural shield against solar wind particles and cosmic radiation. It is mainly generated by dynamo processes in the Earth's fluid outer core. Magnetized rocks in the Earth's crust, electrical currents in ionosphere and magnetosphere in the near-Earth space and even ocean currents add contributions to the Earth's magnetic field. We use geomagnetic field observations from ground and space (satellite missions) as well as paleomagnetic data obtained from geological archives to investigate the geomagnetic field on a broad range of time-scales. We make inferences about dynamic processes inside the Earth and in the near-Earth space environment. Our aims are to estimate the future evolution of the geomagnetic field and contribute to characterizing space weather conditions.