Cancer is the leading cause of death globally, affecting various organs in the human body. Early diagnosis of gastric cancer is essential for improving survival rates. However, traditional diagnosis methods are time-consuming, require multiple tests, and rely on specialist availability. This motivates the development of automated techniques for diagnosing gastric cancer using image analysis. While existing computerized techniques have been proposed, challenges remain. These include difficulty distinguishing healthy from cancerous regions in images and extracting irrelevant features during analysis. This research addresses these challenges by proposing a novel deep learning-based method for gastric cancer classification. The method utilizes deep feature extraction, dimensionality reduction, and classification techniques applied to a gastric cancer image dataset. This approach achieves high accuracy (99.32%), sensitivity (99.13%), and specificity (99.64%) in classifying gastric cancer.