The elemental and phase composition and defect structure of the surface layer on 5140 steel is considered after alloying by melting of a film–substrate (5140 steel) system under irradiation by intense pulsed electron beam; the film consists of aluminum or titanium. Treatment of the titanium–5140 steel system results in alloying to the depth of the molten layer (about 15 μm); polycrystalline structure (with submicron grains) based on α-phase hardened by titanium-carbide nanoparticles is formed. For the aluminum–5140 steel system, only a thin surface layer (about 2 μm) is alloyed, on account of the evaporation of aluminum from the steel surface. Martensit structure hardened by iron-aluminide nanoparticles is formed.