  We calculate next-to-leading-order (NLO) correction to the pion
electromagnetic form factor at leading twist in the $k_T$ factorization
theorem. Partons off-shell by $k_T^2$ are considered in both quark diagrams and
effective diagrams for the transverse-momentum-dependent (TMD) pion wave
function. The light-cone singularities in the TMD pion wave function are
regularized by rotating the Wilson lines away from the light cone. The soft
divergences from gluon exchanges among initial- and final-state partons cancel
exactly. We derive the infrared-finite $k_T$-dependent NLO hard kernel for the
pion electromagnetic form factor by taking the difference of the above two sets
of diagrams. Varying the renormalization and factorization scales, we find that
the NLO correction is smaller, when both the scales are set to the invariant
masses of internal particles: it becomes lower than 40% of the leading-order
(LO) contribution for momentum transfer squared $Q^2>7$ GeV$^2$. It is observed
that the NLO leading-twist correction does not play an essential role in
explaining the experimental data, but the LO higher-twist contribution does.
