As mentioned, the nerve signals passing through the epidural space are blocked by local anaesthetic. The injection spreads up and down over a few centimetres. This causes the local anaesthetic to not only block the nerve that comes out of the spinal cord at the same level that the epidural injection took place, but also the nerves that leave the spinal cord higher up and lower down.
For chest surgery, even higher placed epidurals are necessary (between the shoulder blades on the higher thoracic level). This will block the innervation of the chest and upper abdomen, but not the lower abdomen or the legs.