The Earth's magnetic field has operated for at least 3.4 billion years, yet how the ancient field was produced is still unknown. The core in the early Earth was surrounded by a molten silicate layer, a basal magma ocean that may have survived for more than one billion years. Here we use density functional theory-based molecular dynamics simulations to predict the electrical conductivity of silicate liquid at the conditions of the basal magma ocean: 100-140 GPa, and 4000-6000 K. We find that the electrical conductivity exceeds 10,000 S/m, more than 100 times that measured in silicate liquids at low pressure and temperature. The magnetic Reynolds number computed from our results exceeds the threshold for dynamo activity and the magnetic field strength is similar to that observed in the Archean paleomagnetic record. We therefore conclude that the Archean field was produced by the basal magma ocean.