A cosmic acceleration mechanism is introduced which is based on the wakefields excited by the Alfvén shocks in a relativistically flowing plasma. We show that there exists a threshold condition for transparency below which the accelerating particle is collision-free and suffers little energy loss in the plasma medium. The stochastic encounters of the random accelerating-decelerating phases results in a power-law energy spectrum: f(epsilon) proportional, variant 1/epsilon(2). As an example, we discuss the possible production in the atmosphere of gamma ray bursts of ultrahigh-energy cosmic rays (UHECR) exceeding the Greisen-Zatsepin-Kuzmin cutoff. The estimated event rate in our model agrees with that from UHECR observations.