You may just have a nick in a blood vessel, just see how it goes and leave of masterbating for a few days to a week, then see how it goes.
Blood in sperm is due to hematospermia. It can occur due to many conditions such as infections, swellings (inflammations), cysts, stones & other obstructive lesions, and benign or non-benign tumors of the organs of the genitourinary system (involving the bladder, urethra, the testicles, the seminal vesicles, the epididymis, the prostate gland etc). Investigations include blood tests, routine & culture tests of urine & semen, ultrasound & MRI scans of genitourinary system, and histopathological tests (FNAC, biopsy etc).
It is very difficult to precisely confirm a diagnosis without examination and investigations and the answer is based on the medical information provided. For exact diagnosis, you are requested to consult your doctor. I sincerely hope that helps. Take care and please do keep me posted on how you are doing.