Two-Stage Least Squares (2SLS) generalizes IV to multiple regressors.
Stage 1: regress the endogenous variable X on the instrument Z and all exogenous controls:
Xi = π0 + π1Zi + π2Wi + vi
Save the fitted values X̂i. This is the “clean” part of X, the variation driven by Z, not by ε.
Stage 2: regress Y on X̂i and the controls:
Yi = β0 + β1X̂i + β2Wi + εi
The coefficient β̂1 from Stage 2 is the 2SLS estimate. Important: do not do this manually, the standard errors from the manual Stage 2 are wrong. Use your software’s ivregress or ivreg command.