I always use the automatic sensor cleaning feature on my Nikon D5000 and D7000. Not sure if it works at all because I haven't tested it against turning it off for a while. Regardless, I think everyone will run to this situation sooner or later. The most likely causes of these spots are dust and bits of metal from your lens mount on the sensor. Technically, dust isn't really directly on the sensor it's on the tiny fragile filter that covers the sensor.
The best way to clean your sensor is to send it in to the manufacturer. It will cost you some money and time but it will be guaranteed by professionals that have experience with your exact camera. If you are impatient, a little technical and less afraid than you should be, you can try it yourself. (I suppose the second best way is to bring to a local shop you trust to have them do it.)
Do my best to prevent anything getting into the camera in the first place. Change lenses rarely. Change lenses indoors. Clean my equipment regularly. Minimize using zooms in dusty conditions. When you zoom in and out your are sucking air into the camera.
So, here is what I do. Try this at your own risk. A damaged sensor is a costly repair.
- Erase the spots with software. When that gets annoying, proceed below.
- Use a blower bulb to blow everything off the camera before removing the lens. I also wipe things down with a very slightly damp cloth.
- Remove Lens
- Select the mirror lock-up function in the camera menu and follow the directions. Read the manual with all the instructions and cautions before you do this.
- When the mirror is locked up I point the opening of the camera towards the ground and gentle blow into the camera box with a blower (not canned air or my mouth). Most of the time this solves everything for me.
- Test. I use my Nikkor 35mm f1.8 to test. I crank down the aperture to f16 or smaller and photograph a plane white wall. I take more than one photos at slightly different positions because I spent a whole lot of time attempting to remove a spot from my sensor that was actually on the wall. Doh!
- If I still see spots, I take the lens off, lock up the mirror and use my Arctic Butterfly sensor brush from VisibleDust. It has a tiny yet powerful flashlight on the end so you can see things inside the camera box. This is a motorized brush that you turn on so it spins to built up some static. Then you turn it off and gently run it across your sensor. Follow all VisibleDust's instructions and watch their videos before attempting this. If you do it wrong, you can ruin your sensor. If you want to see what's on your sensor try one of their loupes.
- Test again.
- If I still see spots, I'll try the Arctic Butterfly once or twice more and re-test after each try. I do this because the "wet clean" is scary.
- If the two or three tries with the Arctic Butterfly doesn't solve everything, I do a wet clean. I use VisibleDust's sensor swabs and solutions. I watched all their videos and various other videos I found on YouTube before I did this. I'm not going to get specific because I don't want to miss something or have a typo about this, so study their stuff.
- After each swab, I let the sensor dry, reattached the lens and did some test photos. Repeat until most or all of the spots are gone from your photos.
Be sure you buy the correct size of swab for your particular camera sensor. The swabs I got work for both my Nikon D5000 and D7000 APC-S sized sensors.
In my experience, it wasn't any cheaper to do it myself compared to sending it back to Nikon. I'm about even for what I've spend on supplies for the first two cleanings. I'll be doing well if I can successfully clean 4 or 5 more times with the supplies I have on hand now.
I do not recommend you try this at home but know that I did it successfully and it was easy (and scary).