Wash the table thoroughly with dish soap and hot water. Dry it well with a shop cloth.
Use a wire brush to remove any flaking paint and rust. Wipe the table down again with a shop cloth to get rid of all of the dust.
Go over the entire table, including the legs, with 150-grit sandpaper to roughen the surface. This will help the primer to adhere. Wipe it down again.
Optional: Steel wool and kerosene will remove stubborn rust spots. Wear your rubber gloves, stay away from open flames and rinse the table thoroughly when you are done. Let it dry completely before moving on to the next step.
Place the table on a drop cloth, put on your painter's mask and give the table an even coat of spray primer meant especially for metal tables. Let the spray primer dry according to the manufacturer's instructions and give it a second coat.
Use long, even sweeps of the can to give your table a coat of finish paint made especially for metal. Let it dry according to the manufacturer's instructions, and then give it a second coat if needed.