The authors consider, in a local approximation, a gradient-driven instability in a layer of inhomogeneous plasma, the pressure of which is of the same order as the magnetic field pressure. The characteristic distance over which the plasma density and temperature and the magnetic field vary is assumed to be smaller than the ion Larmor radius, but larger than the electron Larmor radius. It is shown that ion-acoustic oscillations can be built up in this layer by resonant electrons moving in the magnetic field direction at a velocity smaller than or of the order of the thermal velocity, and perpendicular to the magnetic field at the sum of magnetic and cross-field drift velocities. This instability can also occur in a plasma in which the electron and ion temperatures are of the same order of magnitude.