May I Shoot an Intruder?
If someone has invaded your home, and you fear great bodily harm or death, then yes -- the law will generally protect you if you shoot. Outside of those very specific circumstances, the question is a bit too complicated to provide a cut and dried answer.
The law gives everyone the right to defend themselves with a reasonable response. Self-defense is an affirmative defense to a charged violent crime. This means if someone is charged with murder, or assault, they can use self-defense as a legal excuse for the conduct if they can prove it in a court of law.
Any force used against an intruder must usually be proportionate to harm that is reasonably perceived. For example, if a burglar were to enter your bedroom with a yellow banana as a weapon, you would not be justified in shooting them with a 20 gauge shotgun. However, if they were carrying a fake pistol, and you reasonably believed it to be real, you would likely be justified in shooting that intruder.
If you act with a disproportionate response, or believe that banana to be a futuristic space weapon (an unreasonable perception), this becomes what is referred to as imperfect self-defense. This will mitigate the crime you are charged with and usually result in a lesser punishment, though it will not excuse disproportionate response completely.
Duty to Retreat or Stand Your Ground?
In many states, there is a duty to retreat to safety, if possible, before using force. However, in many other states, there are "stand your ground" laws that remove the duty to retreat and allow a person to claim self-defense, even if they made no attempt to flee. However, even in "stand your ground" states there is no license to attack without cause, and the rules vary on the ability to use lethal force.
Again, in some states, a person is privileged to use deadly force against anyone who unlawfully enters their home. In these states, there is no need to take the time to assess the intruder's ability to use deadly or nonlethal force. However, the specifics and applicability vary state to state. If you are uncertain about your state's rule, it may be advisable to consult with an attorney to learn more.