What type of fasteners should I use when replacing exterior deck boards?
Decks have been built with screws for the last 30 years where I live. Nails are unheard of for the reason you mentioned. Your local hardware store will have a selection of epoxy-coated or galvanized screws in various colors that will serve you well. 2-1/2" is typical for 5/4 decking, and 3" for 2-by decking.

You can use a standard drill to drive deck screws. You don't need a screw gun, though the auto-depth feature they offer can save time on large projects.