The Earth's magnetic field acts as a shield, redirecting and trapping the charged particles from the solar wind and preventing them from reaching the planet's surface.