A Relative Positions-Constrained pattern Matching (RPCM) method for underwater gravity-aided inertial navigation is presented in this paper. In this method the gravity patterns are constructed based on the relative positions of points in a trajectory, which are calculated by Inertial Navigation System (INS) indications. In these patterns the accumulated errors of INS indicated positions are cancelled and removed. Thus the new constructed gravity patterns are more accurate and reliable while the process of matching can be constrained, and the probability of mismatching also can be reduced. Two gravity anomaly maps in the South China Sea were chosen to construct a simulation test. Simulation results show that with this RPCM method, the shape of the trajectory in gravity-aided navigation is not as restricted as that in traditional Terrain Contour Matching (TERCOM) algorithms. Moreover, the performance included matching success rates and position accuracies are highly improved in the RPCM method, especially for the trajectories that are not in straight lines. Thus the proposed method is effective and suitable for practical navigation.