Cameron warned his counterpart in a 15-minute phone call of the "real risk" of harm to relations between the countries unless the problems over frontiers checks were resolved.
Downing Street said he had obtained a promise from Rajoy to reduce the protracted checks at the border.
However, a statement from the Spanish Prime Minister's office painted a different picture. It made no reference to cutting border checks and reported he had told Cameron "the adopted measures were perfectly in accordance with the Schengen border code", which governs travel between EU member states.
British officials acknowledged there was still much work ahead to "de-escalate"the standoff.
Nor was there any prospect of Brussels brokering a rapid solution to the standoff. The European Commission is sending a team to examine the border controls, but does not expect talks to take place with Spain on the issue until next month at the earliest. It confirmed the controls are allowed because Gibraltar is not part of the Schengen agreement, which permits people to travel freely within the Schengen area of 26 countries. Independent