To assess the accuracy and limitations of endoscopic ultrasonography (EUS) in the preoperative staging of esophageal and gastric carcinoma, we performed a prospective controlled study over a five year period. Data from 63 patients with esophageal cancer and 147 patients with gastric cancer who underwent surgery were available for comparison of the endosonographic TNM classification to the histophathological findings of the resected specimens. The overall accuracy of EUS in the assessment of tumor infiltration depth was 85.7% and 78% in esophageal and gastric cancer, respectively. The sensitivity of EUS in the detection of regional lymph node metastases was 90% in esophageal and 87% in gastric carcinoma. The most frequent causes of misdiagnoses by endosonography were microscopic tumor invasion and peritumorous inflammatory changes. The inability to traverse a tumor stenosis restricted the endosonographic evaluation in 31.6 and 14% of the cases with esophageal and gastric cancer, respectively.