From an article on Space.com:
Mercury has possessed a magnetic field for billions of years, and that field may have once been as strong as the Earth’s.
As NASA’s MESSENGER spacecraft ended its four-year mission at Mercury, it travelled so low over the surface, at altitudes as low as 15 kilometers, that it was able to detect weak magnetism coming from surface rocks in terrain 3.7 to 3.9 billion years old.
The discovery indicates that Mercury’s magnetic field, generated by liquid rotating in the planet’s core, was that old, helping to constrain scenarios for how Mercury has evolved over time. No trace of magnetism on Earth in rocks older than 3.5 billion years has been found.
Link: Space.com article.