To determine whether a tumor is primary or metastatic, a pathologist examines a sample of the tumor under a microscope. In general, cancer cells look like abnormal versions of cells in the tissue where the cancer began. Using specialized diagnostic tests, a pathologist is often able to tell where the cancer cells came from. Markers or antigens found in or on the cancer cells can indicate the primary site of the cancer.
Metastatic cancers may be found before or at the same time as the primary tumor, or months or years later. When a new tumor is found in a patient who has been treated for cancer in the past, it is more often a metastasis than another primary tumor.
This answer is based on source information from the National Cancer Institute.