The test is also expected to reduce the need for unpleasant endoscopy examinations that require a flexible telescope to be inserted into the stomach via the throat. Around 6,682 people are diagnosed with stomach cancer in the UK every year, with 4,576 dying from the disease. For oesophageal cancer, around 8,919 people are diagnosed and 7,790 die.
For the new study breath samples were collected from 335 patients at three London hospitals. Of these, 163 had been diagnosed with oesophageal or stomach cancer while 172 were shown to be cancer-free after undergoing endoscopy tests. In each breath sample, levels of butyric, pentanoic and hexanoic acids, and the chemicals butanal, and decanal were measured.
Professor George Hanna, head of the research trial, said he hoped the simple breath test would be used in the future to detect "the likelihood of multiple cancers".
Dr Sheraz Markar, one of the researchers from Imperial College London, said: "At present the only way to diagnose oesophageal cancer or stomach cancer is with endoscopy. This method is expensive, invasive and has some risk of complications. A breath test could be used as a non-invasive, first-line test to reduce the number of unnecessary endoscopies. In the longer term this could also mean earlier diagnosis and treatment, and better survival."
The results of the study, presented at the European Cancer Congress meeting in Amsterdam, showed that the test was both good at identifying those patients who had cancer, and unlikely to produce a false diagnosis.
Over the next three years, the researchers plan to run a larger trial including patients not yet diagnosed with cancer.The team is also working on breath tests for other types of cancer, such as those affecting the bowel and pancreas.