How can I replace the NES cartridge battery?

This website seems to provide a good tutorial.

Basically, the battery is soldered to clips that are soldered to the board. You'll need to open the cartridge, remove the clips from both battery and board, replace those clips with a modern clip that can hold a CR2032 battery, clip the new battery in, and close up the cartridge. (Note that these instructions tell you how to solder clips in place; the availability of battery clips is newer, so you will have to modify the process accordingly, starting with step 6, where you would otherwise solder new clips onto the battery.)

Since this is a fairly difficult procedure, you will probably want to try it out on a cheap cartridge you don't care about before attempting to replace the battery on your pristine copy of Final Fantasy.