Dip a thin-bladed putty knife in a can of drywall compound, and wipe off the excess on the lip of the can.
Rub the dry wall compound on to the wall directly over the hole. If the hole is large because of an anchor, use the corner of the putty knife to push the compound inside the hole. Slide the tip of the putty knife back and forth over the hole several times to remove the excess.
Allow the compound to dry for roughly an hour. For small nail holes, it will dry quicker, but for large, anchor-sized holes, wait at least an hour.
Sand the excess compound off the wall using a fine-grit sandpaper such as 180-grit. If you applied the drywall compound tidily, there should be very little excess dried matter to sand.
Touch up the area with the same color of paint as the rest of the wall. While you can use a fine-tipped paintbrush for this process, a cotton swab is equally useful as it allows you to apply the paint precisely.