Wider use of endoscopic hemostasis in upper gastrointestinal bleeding (UGIB) has reduced significantly the need for operation. Nevertheless, surgery still plays a pivotal role. Failure to control bleeding endoscopically should not delay surgery when necessary, and a close cooperation between endoscopists and surgeons is essential. Initial endoscopy stops the bleeding in approximately 94% of patients and helps to identify those patients with a high or low risk of rebleeding. High-risk patients should be examined for rebleeding by clinical and endoscopic assessment within at least the first 2-3 days. Large ulcers are the most likely to rebleed, and in elderly patients with severe comorbidity showing little or no healing tendency, they benefit from repeated fibrin glue treatment. In cases of rebleeding despite initial endoscopic hemostasis and conservative treatment, another attempt to stop the hemorrhage endoscopically is justified in most patients. A subgroup of patients who are old, suffering from hypotension due to rebleeding, with large ulcers and several other illnesses should undergo surgery immediately because endoscopic intervention often fails, and these patients deteriorate quickly. The surgical procedure should be limited to safe hemostasis.