Pilot contamination, defined as the interference during the channel estimation process due to reusing the same pilot sequences in neighboring cells, can severely degrade the performance of massive multiple-input multiple-output systems. In this paper, we propose a location-based approach to mitigating the pilot contamination problem for uplink multiple-input multiple-output systems. Our approach makes use of the approximate locations of mobile devices to provide good estimates of the channel statistics between the mobile devices and their corresponding base stations. Specifically, we aim at avoiding pilot contamination even when the number of base station antennas is not very large, and when multiple users from different cells, or even in the same cell, are assigned the same pilot sequence. First, we characterize a desired angular region of the target user at the serving base station based on the number of base station antennas and the location of the target user, and make the observation that in this region the interference is close to zero due to the spatial separability. Second, based on this observation, we propose pilot coordination methods for multi-user multi-cell scenarios to avoid pilot contamination. The numerical results indicate that the proposed pilot contamination avoidance schemes enhance the quality of the channel estimation and thereby improve the per-cell sum rate offered by target base stations.