After almost 50 years of quiescence, the Cumbre Vieja rift in La Palma underwent a reactivation process that culminated in the eruption of the Tajogaite volcano from September 19 to December 13, 2021. In July 2021, a magnetic station (CFU) was deployed in the western flank of the Cumbre Vieja rift, 2 km away from the site where the eruptive vents would open two months later. In September 2021, a second magnetic station (SAN) was installed near the southern end of the rift. In this paper we study two months of geomagnetic data at CFU before the eruption and three months of geomagnetic data at SAN during the eruption. The analysis of these time series revealed a magnetic signal at the CFU station with an amplitude of 10 nT and a duration of 10 days by mid-August, one month before the eruption onset. We studied possible correlations with other physical parameters (ground deformation, long-period and very-long-period seismic activity) and concluded that this signal could be related to changes in the magnetization of rocks beneath the volcanic edifice caused by magma intrusion and volcanic/hydrothermal fluids circulation preceding the eruption. At the SAN magnetic station, the time series suggests that a slight decrease in the geomagnetic field could reflect the end of the eruptive process.