Surgery is often recommended for cancer in several scenarios. It is a primary treatment for many types of cancer, particularly when tumors are localized and have not metastasized. Surgery may also be used to obtain a biopsy for diagnostic purposes, to stage the cancer, or to remove residual cancer after other treatments like chemotherapy or radiation.