Chang’e 5 lunar samples analyzed with quantum sensors clarify how ancient lunar dynamo activity and asteroid impacts jointly produced the Moon’s remnant magnetism.