Abstract Domestic cats are one of the most popular pets globally, but the process of their domestication is not well understood. Near Eastern wildcats are thought to have been attracted to food sources in early agricultural settlements, following a commensal pathway to domestication. Early evidence for close human–cat relationships comes from a wildcat interred near a human on Cyprus ca. 9,500 y ago, but the earliest domestic cats are known only from Egyptian art dating to 4,000 y ago. Evidence is lacking from the key period of cat domestication 9,500–4,000 y ago. We report on the presence of cats directly dated between 5560–5280 cal B.P. in the early agricultural village of Quanhucun in Shaanxi, China. These cats were outside the wild range of Near Eastern wildcats and biometrically smaller, but within the size-range of domestic cats. The δ13C and δ15N values of human and animal bone collagen revealed substantial consumption of millet-based foods by humans, rodents, and cats. Ceramic storage containers designed to exclude rodents indicated a threat to stored grain in Yangshao villages. Taken together, isotopic and archaeological data demonstrate that cats were advantageous for ancient farmers. Isotopic data also show that one cat ate less meat and consumed more millet-based foods than expected, indicating that it scavenged among or was fed by people. This study offers fresh perspectives on cat domestication, providing the earliest known evidence for commensal relationships between people and cats.