The Prime Minister said the interests of the British territory mattered deeply as he held talks with Fabian Picardo, Gibraltar's Chief Minister, at Downing Street.
The meeting to discuss the ongoing border dispute with Spain came as Spanish police unions organised a protest at the border over injuries reportedly inflicted on a Guardia Civil officer by a driver in a Gibraltar-registered car.
There have been reports of increasing violence at the border in recent days as angry commuters face long queues travelling to their homes in Andalusia.
Mr Cameron told Mr Picardo: "Britain will always stand up for Gibraltar. We will always stand up for the interests of the people who live in Gibraltar.
"It is something that matters to us very deeply."
Mr Picardo thanked him, saying: "The people of Gibraltar know they have a friend in David Cameron and a friend in William Hague.
"That Gibraltar continues to be on your mind means a lot to us."
Mr Picardo also met Mr Hague, on Wednesday, to discuss the row with Spain over an artificial reef built off the enclave's coast.
The Spanish say the 74 concrete blocks on the seabed disrupt an area used by fishing boats, while the Gibraltarians say it is a necessary environmental measure.
The row has gone all the way to the European Commission and continued to simmer in recent days.
Delays of several hours at the frontier have led to claims of violence against Spanish police and Guardia Civil officers.
The Royal Gibraltar Police are investigating claims that "a small number of missiles" were thrown at Guardia Civil officers carrying out stringent traffic checks traffic at the border on Wednesday afternoon.
Protest organisers, the Sindicato Unificado de Policia and Asociacion Unificada de Guardias Civiles unions, have called on the Spanish government to "defend their interests".