The leftist political group Izquierda Unida (IU) joined activists and other protesters in condemning the deal, aimed at stemming the flow of people traveling to Europe.
"Mr Rajoy is making us accomplices of this atrocity," IU chief Alberto Garzon said.
Criticizing plans to send refugees back to Turkey, Garzon said that many people traveling to Europe were escaping "terrorism" and "wars often directly provoked by western countries… and by the western military industry."
"At the doors of Europe, they come across a lack of solidarity and asylum, and detention camps that clearly violate human rights, international law, and the principles and values on which the European Union should have been built," he added.
IU filed the complaint with Spain's Supreme Court, accusing Rajoy and other EU leaders of "having agreed with Turkish authorities to forcibly deport and transfer an unspecified number of people from EU territory," which according to the party's lawyers represents a crime against humanity under Spanish law.
Numerous critics, including the UN, have criticized the EU-Turkey deal, which will see any refugees entering Greek territory automatically sent back to Turkey.
Critics say it raises huge human rights concerns as there are fears over the protection many refugees and migrants will receive in Turkey.
While proponents say the arrangement will break up people smuggling operations and other criminal syndicates, others argue that it demonstrates a lack of humanity and is akin to rejecting many people fleeing conflict and persecution.
Spain's acting PM Rajoy has also come in for criticism over the country's commitment to helping with the resettlement of refugees, after it was revealed that only 18 had been settled in Spain since the start of the crisis, despite Rajoy's previous government pledging to accept 16,000 under an earlier EU refugee plan.