A man achieves an erection when the muscles of the penis relax, allowing blood to flow and pool in the corpora cavernosa of the penis.