No need to jump to alarm on this one. There are several things that can explain why a baby is spitting up blood. Don't start by hitting the panic button, instead consider these possibilities.
Cracked, Sore Nipples
In most cases of breastfeeding babies, that blood is coming from you and not your baby. Consider if you are having issues with cracked or sore nipples. Quite likely, you are bleeding and it is mixing with your breastmilk. Here are some resources you can read to help you heal and decrease the blood in your baby's spit up.
Swallowed Blood During Delivery
If your baby spits up blood shortly after delivery, it may also have a simple, unalarming reason. Sometimes during delivery the baby swallows maternal fetal blood into his stomach. Be sure to notify the medical staff that it happened and continue to monitor your baby.
Forceful Spit Up Can Cause Bleeding
In some very rare instances, a forceful spit up or vomit can cause a small tear in a tiny blood vessel in your baby's esophagus. Again, no need to worry here. This will heal quickly. Keep breastfeeding, taking steps to help reduce spitting up.
When to Worry About Baby Spitting Up
If neither of these seem to explain the blood in your baby's spit up and it continues to persist, then it is definitely time to call the pediatrician. You may be able to request to talk to an office nurse, detail your baby's symptoms and any related behavior (for example is your baby experiencing colic, constipation, distended stomach, fever, etc.) A nurse or doctor may be able to explain the best course of action for you and your baby.
Pursue prompt medical attention should your baby have symptoms of abdominal distention, green vomiting, lethargy, or fever.