Endoscopic ultrasonography was used for assessment of the extent of tumour invasion of the upper gastrointestinal (GI) tract, including analysis of submucosal tumour and detection of lymph-node metastasis. The normal oesophageal and gastric wall was depicted as five layers by endoscopic ultrasonography (EUS). The outer layer invaded by cancer was defined as the depth of tumour invasion. In 173 cases of oesophageal cancer, the depth of cancer invasion was diagnosed correctly in 88%. In 146 cases of gastric cancer, it was diagnosed correctly in 79%. In submucosal tumours of the GI tract, the site of tumour in the wall was diagnosed correctly in 99% and the histological type of tumour was predicted. EUS can also be used to detect small lymph nodes. According to the criteria, used in this study, EUS had a sensitivity of 84%, a specificity of 88% and an overall accuracy of 88% for detection of lymph-node metastases.