An automatic atlas-free method for segmenting the cervical spinal cord on midsagittal T2-weighted magnetic resonance images (MRI) is presented. Pertinent anatomical knowledge is transformed into constraints employed at different stages of the algorithm. After picking up the midsagittal image, the spinal cord is detected using expectation maximization and dynamic programming (DP). Using DP, the anterior and posterior edges of the spinal canal and the vertebral column are detected. The vertebral bodies and the intervertebral disks are then segmented using region growing. Then, the anterior and posterior edges of the spinal cord are detected using median filtering followed by DP. We applied this method to 79 noncontrast MRI studies over a 3-month period. The spinal cords were detected in all cases, and the vertebral bodies were successfully labeled in 67 (85%) of them. Our algorithm had very good performance. Compared to manual segmentation results, the Jaccard indices ranged from 0.937 to 1, with a mean of 0.980 ± 0.014. The Hausdorff distances between the automatically detected and manually delineated anterior and posterior spinal cord edges were both 1.0 ± 0.5 mm. Used alone or in combination, our method lays a foundation for computer-aided diagnosis of spinal diseases, particularly cervical spondylotic myelopathy.