An erection occurs when the soft spongy tissue in the shaft of a man's penis fills with blood, causing the penis to enlarge and stiffen. Spongy spaces (technically known as corpora cavernosa and corpora spongiosa) along the length of the penis fill with blood in response to physical stimulation, psychological stimulation, or both. This process requires that the blood supply and the nerve connections to the penis are working properly.

Dilation of the arteries that feed blood to the penis results in engorgement of the spongy tissue. Simultaneous contraction of the muscles at the base of the penis prevents the blood from draining out through the veins, thus maintaining the erection.

Nerves in the spinal cord also control erection, which receive input from physical contact to the penis and/or surrounding areas, sexual thoughts, dreams, or images, and sex hormones.

Barring an erectile disease, and provided there is sufficient blood flow and nerve impulses, a man is capable of getting an erection when sexually stimulated. It is important to know that erections come and go. The ability of a man to get an erection is an automatic, normal function similar to his ability to breathe and blink his eyes.