Stage 1: sexual excitement or arousal
A man gets an erection with physical or psychological stimulation, or both. This causes more blood to flow into three spongy areas called corpora that run along the length of his penis.
The skin is loose and mobile, allowing his penis to grow. His scrotum - the bag of skin holding the testicles - becomes tighter, so his testicles are drawn up towards the body.
Stage 2: sexual plateau
The head (glans) of his penis gets wider, and the blood vessels in and around the penis fill with blood. This causes the colour to deepen and his testicles to grow up to 50% larger.
His testicles continue to rise, and a warm feeling around the area between the testicles and anus (perineum) develops.
His heart rate increases, blood pressure rises, breathing becomes quicker, and his thighs and buttocks tighten. He's getting close to orgasm.
Stage 3: orgasm and ejaculation
A series of contractions force semen into the urethra, the tube along which urine and semen come out of the penis.
These contractions occur in the pelvic floor muscles, in the tube that carries sperm from the testicles to the penis (vas deferens).
They also occur in the seminal vesicles and the prostate gland, which both add fluid to the sperm. This mix of sperm (5%) and fluid (95%) is called semen.
These contractions are part of orgasm, and the man reaches a point where he can't stop ejaculation happening.
Contractions of the prostate gland and the pelvic floor muscles then lead to ejaculation, when semen is forced out of the penis.
Stage 4: resolution phase of sex
The man now has a recovery phase, when the penis and testicles shrink back to their normal size. He is breathing heavily and fast, his heart is beating rapidly, and he might be sweating.
There's a period of time after ejaculation when another orgasm isn't possible. This varies between men, from a few minutes to a few hours, or even days. The time generally gets longer as men get older.
If a man gets aroused but doesn't ejaculate, this resolution stage can take longer, and his testicles and pelvis might ache.
If you have problems getting an erection or keeping an erection, find information at the Sexual Advice Association.
Find out more about male sexual problems.
Article provided by NHS Choices