In an apparent bid to regain sovereignty over Gibraltar and obtain an ally in its negotiations to join the European Community, Spain today announced that it would lift its 12-year land blockade of the British colony.

Its decision to end the blockade, imposed in 1969 by the late dictator Francisco Franco, was an admission that a policy of sanctions had failed to bring Gibraltar's population of 30,000 to its knees, and that a conciliatory line might be more successful in wresting control back from Britain after 275 years.

Gibraltar, popularly known as "the Rock," has been a bone of contention between London and Madrid ever since it fell to the combined fleets of Britain and Holland in 1704 in the War of Spanish Succession and was ceded by Spain to Britain in the 1713 Treaty of Utrecht.

The blockade closed the land connection to Spain and has meant that to leave the Rock, Gibraltarians must fly to Morocco or Britain, or catch an eight-hour ferry to Tangiers, on the African side of the Strait of Gibraltar.

Diplomatic sources said it would be impossible for Spain to become a member of the European Community and NATO while keeping a border closed with another member. Also, Spain will need Britain as an ally in its negotiation to join the community since some members, particularly France, are deeply worried about low-cost competition from Spanish farmers.

Spanish Prime Minister Leopoldo Calvo Sotelo told a news conference after conferring with British Prime Minister Margaret Thatcher that the blockade would be lifted April 20 and that talks with Britain on outstanding issues would be resumed the same day in Lisbon, Portugal.

The key issue is the desire of Gibraltar's population--Spanish speaking, but mostly of Genoese, Portuguese and Maltese as well as Spanish descent--to remain British. In a 1967 poll, 12,138 people voted to remain associated with Britain while only 44 voted for Gibraltar to be absorbed into Spain.

Calvo Sotelo said he thought it was compatible for Spain to regain its sovereignty over Gibraltar and for the interests of the people of Gibraltar to be "safeguarded." He did not elaborate.

A British government spokesman said "the government will fully maintain its commitment to honor the freely and democratically expressed wishes of the people of Gibraltar. Their wishes are paramount."

Calvo Sotelo said Spain's move was timely because his country had been invited to join NATO. He also said he had discussed with Thatcher his country's application to join the European Community.

Calvo Sotelo may also have been hoping to regain lost domestic political support in the southern province of Andalusia, which borders on Gibraltar, by opening the border and making it possible for Spaniards to work in Gibraltar.

Diplomatic sources said Britain wanted to take a conciliatory line on Gibraltar with Spain's young democracy since it is an issue that arouses strong patriotic feelings in Madrid.

But they added that Britain would not hand over sovereignty of Gibraltar to Spain against the wishes of the Gibraltarians, and that it was up to the Madrid government to convince the people of Gibraltar of the value of becoming part of Spain.

At the April 20 talks in Lisbon, Gibraltar political leaders are expected to form part of the British delegation.

Asked if the talks might just drag on and on, with the British and the Gibraltarians unwilling to give way to Spain's determination to regain sovereignty, Calvo Sotelo said that "both sides have the political will to bring the negotiations to a conclusion," but he added that there was no set timetable.

Under the agreement reached today, Spaniards will be able to cross into Gibraltar, work there, join trade unions and obtain social security benefits.

The Spanish prime minister indicated that he would as planning to offer inducements to the Gibraltarians to become part of Spain. "We will take all the measures necessary to increase the understanding between the 'Rock' and the country," he said.

Of major concern in the talks will be future control of British military bases on Gibraltar. The Rock is a key military position with highly sophisticated listening devices monitoring the activities of ships and submarines sailing in and out of the Mediterranean. Spain wants some role in running its naval and air bases, diplomatic sources said.