In order to address the problem of indoor pedestrian tracking, this thesis carries a research on spatial models’ ability to reduce tracking error of a Wi-Fi positioning system. The grid-based spatial model is employed because it is easy to design and maintain, has high flexibility, is able to provide accurate location data and is powerful for computation. The thesis explores various geometric, topological and semantic features of the grid model and select out the most useful features upon tracking purpose. A tracking algorithm which integrates all selected features of the grid model as well as measurements from Wi-Fi positioning system and magnetometer using the grid filter is proposed. To test the algorithm’s performance, a tracking system is built and several experiments are carried out in a live environment. The experiment results show that the algorithm can determine locations at reasonable places and derive the accurate moving direction of a pedestrian.