It can also be made in a laboratory. Vitamin B12 is used for treating and preventing vitamin B12 deficiency, a condition in which vitamin B12 levels in the blood are too low. It is also used to treat pernicious anemia, a serious type of anemia that is due to vitamin B12 deficiency and is found mostly in older people. Injecting vitamin B12 as a shot, as well as taking through the nose or by mouth, is effective for treating low red blood cell counts caused by poor absorption of vitamin B12. 2  Vitamin B12 deficiency. 3  Taking vitamin B12 by mouth, through the nose, or as a shot is effective for treating vitamin B12 deficiency.