Pedestrian Dead Reckoning (PDR) is a promising algorithm for indoor positioning. However, the accuracy of PDR degrades due to the accumulated error, especially in multi-floor buildings. This paper introduces a three-dimensional (3D) positioning method based on terrain feature matching to reduce the influence of accumulated error in multi-floor scene. The proposed method involves two steps: motion pattern recognition and position matching calibration. The motion pattern recognition aims to detect different motion states, i.e., taking the stairs or horizontal walking, from the streaming data. Then, stair entrances and corridor corners are matched with transition points of motion states and pedestrian turning points, respectively. After matching, calibration is performed to eliminate the accumulated errors. By carrying out experiments on a two-floor closed-loop path with a walking distance about 145 m, it is shown that this method can effectively reduce the accumulated error of PDR , achieving accurate 3D positioning . The average error is reduced from 6.60 m to 1.83 m.