Barring last-minute hitches, the locked gates that have cut off Gibraltar from the Spanish mainland for a dozen years will swing open a few months from now.
Spanish sources are saying that when Prime Minister Leopoldo Calvo Sotelo holds talks in London Jan. 8 with Margaret Thatcher, the way will be prepared for Spain to end its long blockade of ''the rock.''
Already workers on the Spanish side of the gates, which were slammed shut by Gen. Francisco Franco to support his claim that the colony ought to revert to Madrid, are preparing a parking lot to be used by visitors to Gibraltar later this year.
The Spaniards have been told in advance of Calvo Sotelo's London visit that unless they agree to open the frontier, their requests to join NATO and the European Community will almost certainly be blocked by Britain.
Madrid is keen to become a member of both bodies and is expected to compromise over Gibraltar to speed the entry process.
But raising the blockade may not make life much easier for the 20,000 Gibraltarians. They are bracing themselves for a period of belt-tightening.
Last November Britain decided to close the Royal Navy dockyards on Gibraltar, with the loss of up to 2,000 jobs. Gibraltar's work force is under 12,000, and the colony's chief minister, Sir Joshua Hassan, fears that the British cuts will mean a major economic setback for Gibraltar.
The Gibraltarians, who regard themselves as more British than the British themselves, fear that a reopened frontier, coupled with enforced economic austerity, will give Spain the opportunity it has been seeking for many decades - to gain the upper hand over the colony.
This, Sir Joshua fears, could take the form of Spain offering economic help that his own people could not afford to refuse.
British Foreign Secretary Lord Carring-ton, does not believe Gibraltar is destined to slip under Spanish influence, although he seems unlikely to yield to parliamentary demands for reconsideration of the dockyards' closure.
Britain would like to get rid of the responsibility for Gibraltar, and believes a solution may lie in its continuing importance as a military foothold at the mouth of the Mediterranean.
One idea likely to be discussed between Mrs. Thatcher and Calvo Sotelo is for NATO to assume sovereignty over Gibraltar while at the same time making use of the dockyards and related defense facilities.
This would preserve a good many of the jobs threatened by Britain's dockyard shutdown. The Gibraltarians believe, however, that associated with such an agreement there should be a guarantee by Britain to protect them against Spanish political and economic pressures.
Another idea being explored by Sir Joshua and his supporters is to use port facilities, currently monopolized by the Royal Navy, for commerce and tourism. This would require new investment, probably by Britain, to bring facilities up to a satisfactory standard.
The London talks may not yield immediate progress. British sources suggest that Spanish pride is involved in a decision to open the frontier with Gibraltar , and Mr. Sotello will want to show his supporters in Madrid that he has not simply caved in to British pressure.
Nearly two years ago the Spanish government agreed in principle to open the frontier, then backed out when it became apparent that conservative elements in the Madrid government were unhappy with the terms.
This time Britain is looking for solid commitments from the Spanish - ''rock solid'' as one Whitehall official put it - before agreeing to support Spain's applications to join the European Community and NATO.