Islanding protection is one of the most important sources of discrepancy in gridconnected photovoltaic systems. Even when islanding is not very likely to happen, regulations demand the photovoltaic inverters to implement effective protection methods. Due to its several advantages, the frequency shift method of islanding prevention, commonly known as Sandia Frequency Shift, is one of the most important active methods. This method implements a positive feedback of the frequency that tends to move it outside the trip limits in case of islanding. The method shows a very high detection capability, which depends on both the values of the method parameters and the characteristics of the load that remains in the same power section after islanding. This paper develops a mathematical analysis of the Sandia Frequency Shift method and proposes a new methodology to design its parameters as a trade-off between the detection capability, which is evaluated as a function of the load characteristics, and the distortion that the method could introduce in the grid as a consequence of transitory frequency disturbances. The ability of this methodology to design the method parameters and achieve the highest detection capability is satisfactorily proved by means of both simulation and experimental results on a commercial photovoltaic inverter that implements the method once its parameters have been designed with the proposed methodology.