With the aim to expand the understanding of the feeding ecology of the swordfish, two supplementary techniques were used: analysis of stomach contents, including 244 samples; and analysis of stable carbon (δ13C) and nitrogen (δ15N) isotopes, with 128 samples of muscle tissues from animals collected in the western coast of Baja California. Samples were obtained from swordfish captured by the longline fleet that operates along the western coast of Baja California peninsula. Thirty-three different prey types were identified through the analysis of stomach contents. Based on the index of relative importance (IRI), cephalopods accounted for 98.91%, fish 0.88%, and pelagic crustaceans 0.21%. The stable isotope analysis showed δ15N values between 13.05‰ and 19.66‰, and δ13C values between − 19.32‰ and − 15.60‰, indicating that the swordfish feeds primarily on oceanic species. The stable isotope mixing model (SIAR) established that prey species that most contribute to the diet of Xiphias gladius were cephalopods, followed by the crustacean Pleuroncodes planipes, and the fish Lagocephalus lagocephalus. The SIBER test corroborates similar diets between sexes and sex-maturity groups, indicating that all swordfish analyzed essentially occupied the same trophic niche.