The embedding capacity of a histogram-based reversible data hiding technique is primarily determined by the peak height of the histogram. Recently, some studies have tried to embed data in the histogram of prediction errors by modifying the error values and have better embedding efficiency. However, these methods offer no selective embedment mechanism to exclude the positions where the modification in the embedding operation contributes no capacity but merely degrade the image quality. In this paper, a novel coding method for reversible data hiding is presented. A two-stage prediction algorithm that fully exploits the pixel correlations is employed to create more embeddable spaces, and a selective embedment mechanism is used to enhance the image quality. According to the experimental results, the proposed method achieved the highest payload while maintaining the lowest distortion for most standard test images, comparing to other existing histogram-shifting-based reversible data hiding techniques.