The analysis of gravitational lensing by galaxies and galaxy clusters typically relies on ellipsoidal lens models to describe the deflection of light by the involved dark-matter halos. These models are most often based on the isothermal density profile---not an optimal description of the halo, but easy to use because it leads to an analytic deflection-angle formula. Dark-matter halos are better described by the Navarro--Frenk--White (hereafter NFW) density profile. We set out to study lensing by a general triaxial ellipsoidal NFW halo, with the aim of providing an analytic model that would be more consistent with the current understanding of dark-matter halos. We computed the conversion between the properties of a triaxial ellipsoidal lens model and its elliptical surface-density profile. In the case of the NFW lens model, its angular scale is defined by the projected scale semi-major axis of the halo, while its lensing regime depends on two parameters: the projected eccentricity $e$ and the convergence parameter $ s $. We employed the Bourassa Kantowski formalism to compute the complex scattering function of the model, which yields the deflection-angle components when separated into its real and imaginary parts. We present the obtained closed-form expressions for the deflection-angle components, valid for an arbitrary eccentricity of the surface-density profile. We use them to compute and describe the lensing properties of the model, including: the shear, its components, and the phase; the critical curves, caustics, and the parameter-space mapping of their different geometries; the deformations and orientations of images. The analytically solved ellipsoidal NFW lens model is available for implementation in gravitational lensing software. The techniques introduced here such as the image-plane analysis can prove to be useful for understanding the properties of other lens models as well.