By Jon Nazca

GIBRALTAR (Reuters) - Spain will seek to jointly govern Gibraltar with Britain following the British vote to leave the European Union, acting foreign minister Jose Manuel Garcia-Margallo said on Friday.

The peninsula on Spain's south coast, a British territory since 1713 known to its 30,000 residents as "the Rock", is a major point of contention in Anglo-Spanish relations. Spain has long claimed sovereignty over the enclave.

"It's a complete change of outlook that opens up new possibilities on Gibraltar not seen for a very long time. I hope the formula of co-sovereignty - to be clear, the Spanish flag on the Rock - is much closer than before," Garcia-Margallo said.

Chief Minister of Gibraltar Fabian Picardo told the territory's parliament there would be no talks on such a deal. Co-sovereignty with Spain was rejected by around 99 percent of Gibraltarians in a referendum in 2002.

"Let others make irrelevant noises about flying flags over our Rock if they want to waste their breath. Such ideas will never prosper," he said.

The majority of people living in Gibraltar - designated as a British Overseas Territory - are British citizens with British passports, although thousands of Spaniards cross from mainland Spain every day for work.

Gibraltarians voted overwhelmingly in favor of Britain remaining in the European Union but were outnumbered in Thursday's referendum and now face the consequences.

Garcia-Margallo said Spain would push to keep Gibraltar out of any general Brexit negotiations between Britain and the European Union and will aim for bilateral talks to seek co-sovereignty and eventually Spanish control of the peninsula.

Britain rejects any notion of Spanish sovereignty against the wishes of the people of Gibraltar, one of the most prosperous regions in Europe with a thriving economy based on financial services, tourism and Internet gambling.

The mood was subdued in Gibraltar on Friday, with people apprehensive and confused about what the result may mean for the movement of labor and capital over the border with Spain.

"MASSIVE SHOCK"

Gibraltar has complained in the past about excessive border controls on the Spanish side. Disputes have also broken out between Spain and Britain over fishing in waters around the Rock.

"We're very worried now about what may happen with the border," said Clive, a 54-year-old tax consultant who declined to give his surname, sitting outside a bar in a central square.

"Many companies set up here because it's part of the European Union. We think this result will have a negative effect on the economy."

Aaron Payas, a 31-year-old lawyer, said: "There is a lot of concern within the financial services sector given the outcome. The result is a massive shock."

Spain's acting Prime Minister Mariano Rajoy said Britain's vote to leave the EU would not affect the rights of Spanish workers who he said would be able to continue to move freely between the two territories.

Spain itself holds an election on Sunday, its second in six months after an inconclusive vote in December. Polls forecast a fragmented result with no clear winner, potentially leading to weeks of negotiations over the formation of a coalition government.

(Additional reporting by Angus Berwick, Writing by Sonya Dowsett, Editing by Julien Toyer and Robin Pomeroy)