It is the latest in a long string of diplomatic skirmishes over the tiny Mediterranean peninsula which has been governed by Britain since 1713 but is claimed by Spain.
Gibraltar's Chief Minister Fabian Picardo said the incident "put the lives of innocent Gibraltarian civilians at risk" and "represents an extremely serious excalation of the repeated Spanish violations of British-Gibraltar sovereignty".
"We are working closely together with the UK government so that necessary and appropriate action is taken to counter this unacceptable threat," he added.
The skirmish took place on Saturday when the crew of a Spanish customs vessel, the Aguila IV, ordered two men on a Gibraltar-registered fishing boat to stop their engine.
"Its crew also attempted to board the pleasure boat which took evasive action. During this time, the shots were fired by the Spanish customs vessel crew into the sea near the boat and objects which they believe to have been bricks were allegedly thrown at the local men," the government of Gibraltar said in a statement.
The two men then contacted Royal Gibraltar Police who sent a police launch to the scene and escorted it to Gibraltar's marina.
Gibraltar said that the two men had all the required fishing permits and were not behaving in any way illegally.
The incident comes after a Spanish customs vessel and helicopter chased suspected drug smugglers onto a beach in Gibraltar on August 9, in what the British government said was "clear violation of UK sovereignty".
Just days before that, a Spanish customs vessel chased a speedboat into a demarcated swimming area off another Gibraltar beach.
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.
Relations became particularly strained in 2013 after Gibraltar dropped 70 concrete blocks into the sea in July, in what its government said was an attempt to create an artificial reef.
Spain said the move blocked Spanish fishing boats from working in key waters off Gibraltar and it tightened its border checks, causing lengthy queues for workers and tourists crossing between Gibraltar and southern Spain.