Cameron also told Mariano Rajoy in the telephone conversation that Britain's stance on Gibraltar's sovereignty would not change.
The British prime minister called Rajoy "to raise serious concerns about actions by the Spanish at the border with Gibraltar", a Downing Street spokeswoman said.
The British premier said the issue "should not damage our bilateral relations. However there was a real risk of this happening unless the situation at the border improved," the spokeswoman said.
Gibraltar had accused Spain of deliberately holding up cars entering the tiny British overseas territory by searching every vehicle and creating delays of up to six hours during the last weekend in July.
Gibraltar's chief minister argued that the heightened border checks were in retaliation over its decision to build an artificial reef in surrounding waters, aimed at stopping alleged incursions by Spanish fishing boats in waters around the peninsula which Madrid claims as its own.
On Wednesday, Rajoy told Cameron that Gibraltar's move to build the reef was "unacceptable", a Spanish government statement said.
Tensions rose further over the weekend when Spanish Foreign Minister Jose Manuel Garcia-Margallo suggested that Madrid could impose a €50 ($66) charge to cross the Gibraltar border in either direction.
Cameron called Rajoy "to raise serious concerns about actions by the Spanish at the border with Gibraltar and suggestions from (Garcia-Margallo) that they may introduce further measures," the spokeswoman said.
"The PM made clear that our position on the sovereignty of Gibraltar and its surrounding waters will not change.
"He also reiterated, as the PM and Mr Rajoy had previously agreed, that the issue should not damage our bilateral relations. However there was a real risk of this happening unless the situation at the border improved.
"Mr Rajoy agreed that he did not want the issue to become an obstacle in the bilateral relations and that we needed to find a way to de-escalate the issue.
"As a next step, the Foreign Secretary (William Hague) should speak to Mr Garcia-Margallo to discuss a way forward.
"In the meantime, Prime Minister Rajoy committed to reducing measures at the border. Both leaders agreed that there should be a solution to the fishing dispute."
Spain ceded Gibraltar to Britain in perpetuity in 1713 but has long argued that it should be returned to Spanish sovereignty. London says it will not do so against the wishes of Gibraltarians, who are staunchly pro-British.
The internally self-governing British overseas territory, measuring just 6.8 square kilometres (2.6 square miles), is home to about 30,000 people.
The peninsula, dominated by the giant limestone Rock of Gibraltar monolith, overlooks the only entrance to the Mediterranean Sea from the Atlantic Ocean.