We investigated electron-beam lithography with an aberration-corrected scanning transmission electron microscope. We achieved 2 nm isolated feature size and 5 nm half-pitch in hydrogen silsesquioxane resist. We also analyzed the resolution limits of this technique by measuring the point-spread function at 200 keV. Furthermore, we measured the energy loss in the resist using electron-energy-loss spectroscopy.