Are black spots on the underside of roof sheathing mold?
Yes it is mold , don’t panic all wood has mold spores.
Most of the spores are not hazardous the only way to know is by testing.
If you want to kill the mold bleach water OR hydrogen peroxide and water 3% both will kill surface mold. I prefer hydrogen peroxide as it doesn’t stink. 
Keeping the attic well vented really helps to stop mold growth but a few spots like you have is quite normal, 
Why don’t you see mold in the lumber yard? After wood is finished it is sprayed with a fungicide that stops mold growth for a couple of months, kiln dried has the moisture removed so it doesn’t get the treatment. 
I tried to cover common issues as some folks are panicked by the word mold when most of the time it is harmless and has been there for years, if new may indicate a roof leak or moisture source in the attic space.