How an erection occurs
A man's erection begins in the brain. Physical and/or mental stimulation causes nerves in the brain to send chemical messages to nerves in the penis, telling the penile blood vessels to relax so that blood can flow freely into the penis. Once blood is in the penis, high pressure traps it within both corpora cavernosa to sustain an erection. This causes the penis to expand, creating an erection.
Erection is reversed when the inflow of blood is stopped and outflow channels open, allowing the penis to become soft.
How does ejaculation occur?
Ejaculation, the release of semen at climax, is triggered when the man reaches a critical level of excitement. Sexual stimulation causes nerves in the penis to send chemical messages or impulses to the spinal cord and into the brain. There, more chemical messages are sent back to the penis causing ejaculation.
Ejaculation has two phases. In the first, the vas deferens, the tubes that store and transport sperm from the testes, contract to squeeze the sperm toward the prostate gland and urethra, and seminal vesicles release secretions that make semen. In the second phase, muscles at the base of penis contract every 0.8 seconds and force the semen out of the penis in up to five spurts.