The incidence and mortality of gastrointestinal (GI) tumors are high in China. Some studies suggest that the gut microbiota is related to the occurrence and development of tumors. At present, there are no prospective studies based on the correlation between gastrointestinal tumors and gut microbiota in the Chinese population. The objective of this report is to characterize the fecal microbiota in healthy control participants and patients with esophageal cancer, gastric cancer, and colorectal cancer. Patients with locally advanced or metastatic esophageal, gastric, and colorectal cancer were enrolled, and healthy people were included as controls. 16S rRNA sequencing was used to analyze the characteristics of fecal microbiota. PICRUSt software was used for functional prediction. Significant differences in the composition and abundance of fecal microbiota were identified between gastrointestinal cancer patients (n = 130) and healthy controls (n = 147). The abundance of Faecalibacterium prausnitzii, Clostridium clostridioforme and Bifidobacterium adolescent in tumor groups were all significantly lower than in the control group (P < 0.05). The levels of Blautia producta and R. faecis in the gastric (n = 46) and colorectal cancer (n = 44) groups were significantly lower than those in the control group (P < 0.05). The level of Butyricicoccus pullicaecorum in the esophageal cancer (n = 40) and gastric cancer groups was significantly lower than that in the control group (P < 0.05). B. fragilis, Akkermansia muciniphila, Clostridium hathewayi and Alistipes finegoldii were overabundant in the different tumor groups compared with the control (P < 0.05). We observed significant differences in functional metabolism and cell biological function between the tumor and control groups (P < 0.05). Optimal microbial markers were identified on a random forest model and achieved an area under the curve of 85.59% between 130 GI cancer samples and 147 control samples. The respective AUC values were 86.89%, 97.11%, and 79.1% in detecting esophageal cancer, gastric cancer, and colorectal cancer. Patients with esophageal or gastric cancers had similar features of fecal bacteria as those with colorectal cancer. The metabolic function of fecal bacteria in the gastrointestinal cancer patients and the healthy controls were different. The microbial signatures may potentially be applied to distinguish GI cancer patients from healthy people as a non-invasive diagnostic biomarker.