Electron acceleration by the ponderomotive force of a laser pulse with duration less than the plasma wavelength in inhomogeneous underdense plasmas is studied by two-dimensional relativistic parallel particle-in-cell (PIC) code. Particular attention is paid to the mechanism of electron acceleration associated with the increasing group velocity of the laser pulse. In an underdense plasma layer with linearly descending density profile, the accelerated electrons move together with the laser pulse which propagates with increasing group velocity. In an inhomogeneous pre-plasma with linearly ramping density profile, as the incident laser propagates up the density gradient with decreasing group velocity, ponderomotive acceleration is reduced compared with the uniform pre-plasma. As the reflected laser propagates down the density gradient with increasing group velocity, the ponderomotive acceleration by the reflected laser is more effective due to increasing group velocity of the reflected light and the return currents induced by the incident laser light. Relativistic electrons with multi-tens-MeV energies are generated.