A simple breath test could soon be used to diagnose early cases of two deadly cancers.
Findings from a large trial involving more than 300 patients have shown that the test can identify stomach and oesophageal cancers with 85% accuracy.
Both types of cancer are often diagnosed late, leading to poor survival rates.
Scientists hope the new breath test will ultimately lead to cancers being spotted earlier, resulting in more effective treatment and saved lives.
It is also expected to help doctors avoid unnecessary endoscopy examinations - unpleasant diagnostic procedures that require a flexible telescope to be inserted down the throat and into the stomach.
Dr Sheraz Markar, one of the trial 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."
Each year in the UK around 6,682 people are diagnosed with stomach cancer and 4,576 die from the disease.
Similar figures for oesophageal cancer, affecting the food pipe or gullet, show 8,919 new cases per year and 7,790 deaths.
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.
The results, 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.