A substituted benzothiazolinic spiropyran was synthesized through a reaction between 2-hydroxy-3-methoxy-5-nitrobenzaldehyde and 2-ethyl-3-methylbenzo[d]thiazol-3-ium-4-toluenesulfonate in the presence of piperidine. The spiropyran derivative was characterized using IR, NMR, mass and SCXRD analysis. Owing to the presence of a methoxy group ortho to the phenolic oxygen atom, the affinity of the synthesized spiropyran derivative towards toxic metal ions was investigated in CH3CN: water (1:1). A hypsochromic shift in the absorption and fluorescence spectra was observed in response to the presence of Hg2+ ions. The formation of complex was also observed through a visible change in color from dark yellow to colorless. UV–vis, fluorescence spectroscopy and digital image analysis were used to obtain good limit of detection value (5.5 μM, 78.5 nM and 0.62 μM, respectively) for the receptor towards Hg2+ ions. The 1H-NMR spectroscopy indicated the interaction of the phenolic oxygen atom and Hg2+ ions. The density functional theory was further used to investigate the stabilities of the different stereoisomers of the spiropyran derivative and their complex. The DFT studies also supported the interaction between the phenolic oxygen atom and the Hg2+ ions. TD-DFT studies were also performed to analyze the observed changes in the UV-Visible spectra upon addition of the Hg2+ ions, which indicates an increase in the HOMO-LUMO gap.