Sagami-ji (or Sagami-dera), is a Shingon Buddhist temple in Kasai, Hyōgo Prefecture, Japan. Its mountain name (sangō) is Senjōsan. Emperor Shōmu ordered its construction in the 17th year of the Tenpyō era (745 AD), at the request of Gyōki, a Buddhist priest. According to the temple records, the priest Gyōki received an oracle from Sagami Myōjin (modern Sumiyoshi-jinja) instructing a temple to be built on these grounds. Gyōki took the request to Emperor Shōmu, who then ordered the construction of Sagami-ji.
When finished in 745, it was named Sagami after the oracle's origins. Inscriptions on temple plaques record later visits from various emperors and shoguns, including shogun Tokugawa Ieyasu. The building was badly damaged in the Heiji Rebellion of 1159, and later rebuilt. The main temple was burnt down in conflicts during 1578, and was not rebuilt until the daimyo of Himeji, Honda Tadamasa, agreed to aid the Ikeda clan in its reconstruction.