Gravitational potential energy is energy an object possesses because of its position in a gravitational field. Since the force required to lift it is equal to its weight, it follows that the gravitational potential energy is equal to its weight times the height to which it is lifted.
As the "plates" on each side of ridges in the seafloor are pulled away, lava comes up from the middle, hardens and "records" the current magnetic field.