In this paper, tetramethyl cucurbit[6]uril (TMeQ[6]) and 1,2-bis(4-pyridyl)ethene (G) were used to construct a supramolecular fluorescent probe G@TMeQ[6]. The host–guest interaction between TMeQ[6] and G was investigated using1H NMR spectroscopy, single-crystal X-ray diffraction and various experimental techniques. The results show that TMeQ[6] and G form an inclusion complex with a host–guest ratio of 1:1 and the equilibrium association constant (Ka) was 2.494 × 104M−1. The G@TMeQ[6] fluorescent probe can sensitively recognize Hg2+ions by fluorescence enhancement. The linear range is 0.33 × 10−5–1.65 × 10−5mol·L−1,R2= 0.9926, and the limit of detection is 4.12 × 10−8mol·L−1. The fluorescent probe can be used to detect the concentration of Hg2+ions in aqueous solution, and provides a theoretical basis for the development of new fluorescent probes for detecting heavy metal ions.