The nonlinear response of a compressible boundary layer to unsteady free-stream vortical fluctuations of the convected-gust type is investigated theoretically and numerically. The free-stream Mach number is assumed to be of O(1) and the effects of compressibility, including aerodynamic heating and heat transfer at the wall, are taken into account. Attention is focused on low-frequency perturbations, which induce strong streamwise-elongated components of the boundary-layer disturbances, known as streaks or Klebanoff modes. The amplitude of the disturbances is intense enough for nonlinear interactions to occur within the boundary layer. The generation and nonlinear evolution of the streaks, which acquire an O(1) magnitude, are described on a self-consistent and first-principle basis using the mathematical framework of the nonlinear unsteady compressible boundary-region equations, which are derived herein for the first time. The free-stream flow is studied by including the boundary-layer displacement effect and the solution is matched asymptotically with the boundary-layer flow. The nonlinear interactions inside the boundary layer drive an unsteady two-dimensional flow of acoustic nature in the outer inviscid region through the displacement effect. A close analogy with the flow over a thin oscillating airfoil is exploited to find analytical solutions. This analogy has been widely employed to investigate steady flows over boundary layers, but is considered herein for the first time for unsteady boundary layers. In the subsonic regime the perturbation is felt from the plate in all directions, while at supersonic speeds the disturbance only propagates within the dihedron defined by the Mach line. Numerical computations are performed for carefully chosen parameters that characterize three practical applications: turbomachinery systems, supersonic flight conditions and wind tunnel experiments. The results show that nonlinearity plays a marked stabilizing role on the velocity and temperature streaks, and this is found to be the case for low-disturbance environment such as flight conditions. Increasing the free-stream Mach number inhibits the kinematic fluctuations but enhances the thermal streaks, relative to the free-stream velocity and temperature respectively, and the overall effect of nonlinearity becomes weaker. An abrupt deviation of the nonlinear solution from the linear one is observed in the case pertaining to a supersonic wind tunnel. Large-amplitude thermal streaks and the strong abrupt stabilizing effect of nonlinearity are two new features of supersonic flows. The present study provides an accurate signature of nonlinear streaks in compressible boundary layers, which is indispensable for the secondary instability analysis of unsteady streaky boundary-layer flows.