The continental margins of the South China Sea (SCS) have undergone episodic rifting since the Cenozoic, and there are great divergences in processes of the crustal deformation and seafloor opening. In this work, we present a P-wave velocity model starting from north of Xisha Trough to Zhongshanan Basin in the northwestern SCS margin by modeling the ocean bottom seismometers data of a wide-angle seismic profile OBS2013-1. The results show that the crust thins symmetrically across the western Xisha Trough, from more than ~20 km at the flanks to ~10 km in the central valley where the sedimentary layers thicken to over 6 km. In the Zhongsha Trough closer to the deep basin, the upper crust is detached in a ~20 km wide region and the lower crust is intruded by volcanism and has seismic velocities increased by more than ~0.3 km/s. The volcanic intrusion was blocked by a shearing boundary between the brittle and ductile crust. A ~50 km wide ocean-continent transition region beneath the Zhongshanan Basin is underlain by ~6 km thick continental crust and shows high magnetic anomalies related to early stage magmatism and magnetized upper mantle. These observations, together with plate reconstructions based on gravity and magnetic analysis, suggest that the continental margin was deformed by crustal detachment and prominent magmatism that was followed by a rapid accretion of the oceanic crust.