The hippocampus is divided into dorsal and ventral zones along its principal axis. The dorsal hippocampus is critical for learning and memory, yet the basic function of the ventral hippocampus remains elusive. Here we genetically manipulate a subset of excitatory neurons expressing the serotonin receptor 2c (Htr2c) in the ventral hippocampus. Genetically modified virus tracing reveals that these Htr2c cells establish monosynaptic excitatory connections with newly identified neurons in the Edinger–Westphal nucleus (EW), which directly innervate the medial prefrontal cortex. Inactivation of Htr2c cells impairs behavioral performance in a visual-detection task that demands attention, without affecting novel-object recognition, learning, or memory. This attention deficit was recapitulated by inhibition of EW cells and rescued by activation of EW cells or synaptic projections from Htr2c cells onto EW cells. This study uncovers a synaptic pathway for control of attention.