Tadalafil works by inhibiting the enzyme PDE5, which regulates blood flow in the penis. By blocking PDE5, tadalafil increases the levels of cyclic guanosine monophosphate (cGMP), leading to the relaxation of smooth muscles in the penile blood vessels. This relaxation allows for increased blood flow to the penis, facilitating an erection during sexual stimulation.