Identification and preservation of the cavernous nerves (CNs) during prostate cancer surgery is critical for post-operative sexual function. Electrical nerve stimulation (ENS) mapping has previously been tested as an intraoperative tool for CN identification, but was found to be unreliable. ENS is limited by the need for electrode-tissue contact, poor spatial precision from electrical current spreading, and stimulation artifacts interfering with detection. Alternatively, optical nerve stimulation (ONS) provides noncontact stimulation, improved spatial selectivity, and elimination of stimulation artifacts. This study compares ENS to pulsed/CW ONS to explore the ONS mechanism. A total of eighty stimulations were performed in 5 rats, in vivo. ENS (4 V, 5 ms, 10 Hz) was compared to ONS using a pulsed diode laser nerve stimulator (1873 nm, 5 ms, 10 Hz) or CW diode laser nerve stimulator (1455 nm). Intracavernous pressure (ICP) response and nerve compound action potentials (nCAPs) were measured. All three stimulation modes (ENS, ONS-CW, ONS-P) produced comparable ICP magnitudes. However, ENS demonstrated more rapid ICP response times and well defined nCAPs compared to unmeasurable nCAPs for ONS. Further experiments measuring single action potentials during ENS and ONS are warranted to further understand differences in the ENS and ONS mechanisms.