Analysis of the Earth's magnetic field components fluctuations, recorded at the magnetic observatory of the Institute of Ionosphere (Almaty, Kazakhstan) during the earthquakes of 22.01.2004 and 04.03.2024 showed that these fluctuations were not associated with acoustic-gravitational waves. Cause of the variations turned out to be mechanical vibrations of the foundation of magnetic observatory’s pavilion. Mathematical apparatus was proposed and equations were derived linking the variations of the magnetic field components with the angles of inclination of the magnetic field sensors and the bearing to the epicenter of the earthquake. Calculations of azimuths of earthquake epicenters were performed based on data from a network of seismic stations, and on measured variations of the magnetic field components of the Almaty magnetic observatory. The results obtained showed a good match, which makes it possible to use data from magnetic observatories with per-second registration of magnetic field components to observe seismic events.