The nanocavity defined by the coinage-metal tip and substrate in a scanning tunneling microscope (STM) can provide highly localized and dramatically enhanced electromagnetic fields upon proper plasmonic resonant tuning, which can modify the excitation and emission of a single molecule inside the nanocavity and produce intriguing new optoelectronic phenomena. In this talk, I shall demonstrate two STM-based phenomena related to single-molecule optical spectroscopy. The first is single-molecule Raman scattering [1,2]. The spatial resolution of tip enhanced Raman spectromicroscopy has been further driven down to a single chemical-bond scale. Such simultaneous energetically and spatially resolved capability for vibrational-mode mapping opens up a new possibility to determine molecular chemical structure by optical imaging at only a single molecule. The second phenomenon is single-molecule electroluminescence [3-5]. A variety of interesting optoelectronic phenomena of a single molecule in a nanoscopic environment will be presented, from single-photon emission to coherent dipole-dipole coupling and single-photon superradiance.