Innervation of the thoracic wall is mainly by the intercostal nerves, which are the anterior rami of spinal nerves T1 to T11 and lie in the intercostal spaces between adjacent ribs. The anterior ramus of spinal nerve T12 (the subcostal nerve) is inferior to rib XII (Fig. 3.32).