The bill curbing the use of the doctrine of universal jurisdiction, which allows judges to try certain cases of crimes against humanity that took place in other countries, was passed by 180 votes to 137.
Since the doctrine passed into national law in 1985, crusading Spanish judges have used it to pursue US soldiers in Iraq, Israeli defence officials and Argentine military officers.
While very few probes opened under the doctrine have seen people brought to trial in Spain, investigations have sparked diplomatic rows with some countries.
A Spanish judge earlier this month sought international arrest warrants for former Chinese president Jiang Zemin, former prime minister Li Peng and three other top Chinese officials as part of a probe into alleged genocide in Tibet
That prompted a diplomatic protest from China, a significant economic partner of Spain, which said it was "strongly dissatisfied and firmly opposed" to the judge's move.
The spokesman of Spain's ruling conservative Popular Party said the reforms outlined in the bill were needed to avoid "useless disputes that only generate diplomatic conflicts".
Under the bill, judges could investigate crimes against humanity, war crimes and genocide only if the suspect is a Spanish national, a foreigner living in Spain or a foreigner in Spain whose extradition has been denied by Spanish officials.
Amnesty International and other human rights groups in a joint statement called the proposal "a step backwards in the fight against impunity for crimes under international law, for justice and human rights".