The Spanish air force Falcon plane "returned as a precaution" to Dublin, a spokeswoman for the Spanish government said.
Rajoy resumed his trip to Madrid after the plane was checked and given the all clear, she said.
Irish Prime Minister Enda Kenny called Rajoy to ask about the problem with the plane, the spokeswoman said.
Rajoy was in Dublin for a congress of the European People's Party which picked former Luxembourg prime minister Jean-Claude Juncker as their candidate to be the next European Commission president.
In January another Spanish air force plane carrying Crown Prince Felipe from Santo Domingo to Tegucigalpa in Honduras was forced to return to the capital of the Dominican Republic after a warning light came on.
In November 2013 his departure to Brazil from Madrid was delayed after the Airbus 310 plane which he was scheduled to take suffered technical problems.