Assess the complexity of the scratch. If it is very deep and wide (more than 1/4 inch deep or more than 1/2 inch wide) you may need to replace the entire board. If it is just a simple scratch, you can proceed with the fix. The issue is that you have to sand down the board to remove the scratch. If you have to sand down too far or the area is quite large, the board will be uneven; in that case, replacement is a much better option.
Remove any dirt and debris from the wood before you begin. Use a damp, soft cloth. If there are splinters around the scratch, chip these away gently with a wood chisel. Mark off with a line of tape the area where you will be sanding. This gives you a visual guide of the project area and keeps you from getting overzealous with your sanding -- it can happen to all of us.
Sand down the area with a medium grade of sandpaper. A block hand sander is a little easier on the hands that a sheet of sandpaper, but either will work. If the scratch is deep, fill it in with wood putty that matches the color of the floor as closely as possible. Use a plastic putty knife to apply the putty and scrape off any excess immediately. Once this dries, sand down the area until it is as level as possible.
Refinish the patch to minimize its appearance. Use the same wood stain as you did before on your floor, or match it as closely as possible. Apply at least one coat, preferably two, of the stain and let this dry. Don't forget to sand in between coats. Apply another two coats of polyurethane, sanding in between each coat, to protect the wood. If your floors are very old, you may want to consider covering the entire floor in a coat of polyurethane. This will help protect against future scratches.