Yes. Erections are a perfectly normal function of the male body, especially in guys who are going through puberty.
What Is an Erection?
An erection is a hardening of the penis that occurs when sponge-like tissue inside the penis fills up with blood. Usually, an erection causes the penis to enlarge and stand away from the body.
Erections can go away on their own or after ejaculation, the release of semen through the urethra, the small hole at the tip of the penis.
Sometimes guys ejaculate at night while sleeping (these are called nocturnal emissions or wet dreams). Guys may have several erections and arousal periods while in the REM (rapid eye movement) stage of sleep, the type of sleep in which most dreams occur.
What Causes Erections?
Although many erections are caused by sexual arousal, such as watching a sexy television show or fantasizing, many erections seem to happen for no particular reason.
So if you've had an erection in an odd or embarrassing situation — like right in the middle of a really boring history lesson — there's no reason to worry that something is wrong with you. Your body is just acting naturally for a guy your age.
Am I Getting Too Many Erections?
Because each guy is different, it's impossible to say what's a "normal" number of erections. Some guys experience many erections each day, whereas others may not experience any.
Hormones fluctuate with age, sexual maturity, level of activity, and even the amount of sleep a guy gets. Unless your erections are causing you discomfort or pain, don't worry about how many you get.
If you're concerned, talk to your doctor, who can answer your questions and probably put your mind at ease.
What Can I Do to Avoid Getting Erections?
Because erections usually aren't controllable, there's not much you can do to avoid getting them. Unless the penis is stimulated enough to ejaculate, time is the only thing that will help them go away.
As your hormones settle down and you advance through puberty, the frequency of unexpected erections and wet dreams should decrease.