An algorithm for GPS receivers to calculate the optimal weights is proposed in this paper, which are orthogonal to all the steering vectors of jammings in the weight space. The optimal weights is obtained directly by MUSIC algorithm. It fits for both the strong interferences and the weak ones. The comparison between this algorithm and the power-inversion algorithm has been done. The effectiveness of this algorithm is shown by the simulation results.