Posterior branches of thoracic nerves
The posterior branches of thoracic nerves branch from the dorsal rami of the thoracic nerves. Branches

Medial branches
The medial branches of the posterior divisions of the upper six thoracic nerves run between the semispinalis dorsi and multifidus, which they supply. They then pierce the rhomboidei and trapezius, and reach the skin by the sides of the spinous processes. The medial branches of the lower six are distributed chiefly to the multifidus and longissimus, occasionally they give off filaments to the skin near the middle line. Lateral branches
The lateral branches increase in size from above downward. They run through or beneath the Longissimus dorsi to the interval between it and the Iliocostales, and supply these muscles; the lower five or six also give off cutaneous branches which pierce the Serratus posterior inferior and Latissimus dorsi in a line with the angles of the ribs. The lateral branches of a variable number of the upper thoracic nerves also give filaments to the skin. The lateral branch of the twelfth thoracic, after sending a filament medialward along the iliac crest, passes downward to the skin of the buttock. Medial cutaneous branches
The medial cutaneous branches of the posterior divisions of the thoracic nerves descend for some distance close to the spinous processes before reaching the skin, while the lateral branches travel downward for a considerable distance—it may be as much as the breadth of four ribs—before they become superficial; the branch from the twelfth thoracic, for instance, reaches the skin only a little way above the iliac crest. Additional images

References 

Spinal nerves