Focused electron beams are created by accelerating electrons using an electric field and then focusing them with magnetic or electrostatic lenses. The electrons are emitted from a source, such as a tungsten filament or a field emission gun, and are then accelerated to high speeds in a vacuum. The lenses then focus the electron beam to a fine point, which can be directed onto a sample.