The Hongqiao Airport–Pudong Airport urban railway construction project in Shanghai, includes a 156.1-m-long deep strip foundation pit that runs closely parallel to the subgrade of the Shanghai–Hangzhou High-speed Railway, operating at 300 km/h. With a maximum excavation depth of 25.5 m and a minimum distance of only 10.6 m between the outer edge of the pit and the subgrade slope foot, controlling the deformation of the foundation pit in soft soil and ensuring the safe operation of the adjacent high-speed railway present significant challenges. Various protective measures were implemented to mitigate subgrade deformation caused by pit excavation, including partition excavations, 1.5-m-thick diaphragm walls, a servo steel strut system, isolation piles between the subgrade and diaphragm walls, and water-resistant barriers. The foundation pit, soil, and railway subgrade deformations during excavation were measured and analysed. The results demonstrate that the protective measures limited lateral diaphragm wall deformation to within 0.14% of the excavation depth. The maximum horizontal and vertical displacements of the subgrade caused by excavation were 3.2 mm and 1.5 mm, respectively. As a result, trains safely passed through this section at a limited speed of 120 km/h. The findings presented provide useful reference information for similar projects.