This communication addresses the maximization of the directivity from a radiating aperture through the derivation of a closed-form expression for the modal field amplitudes whose field distribution at the aperture maximizes the directivity in a desired direction. This closed-form expression arises from a convex formulation of the maximization problem (as a ratio of two Hermitian forms), which mathematically ensures that the achieved directivity value is the global maximum for a specified number of propagating modes. The proposed technique, which is valid for any aperture shape and polarization, is discussed and compared with previous work. Several numerical examples considering different main lobe directions, aperture geometries, and polarizations are presented. To verify the numerical results, radiation patterns and directivity values are computed using both commercial tools and in-house developed software.