Both.
Math wise this is very simple, and it works in real life and also in LFS for the same reasons.
Think about it:
For your vehicle to get a move on, there has to be a torque generated at the axles of the driven wheels. Though really, most people forget about the fact that the torque at the axles is not just a product of the engine's output, but rather it's a product (even in the mathematical sense) of the entire drivetrain. If I wasn't a lazy SOB I would post some numbers about wheel torque in different gears vs engine output etc, but the concept is straight foward enough.
Wheel torque is directly related to engine torque BY the gear ratios in between the said engine and wheels. The implications of that are what don't occur to everyone right off the bat.