The next step is for a full legal text to be finalised, which Lammy said all parties were “committed to completing as quickly as possible”.
The Conservatives have said they will examine the the final treaty to ensure it meets their red lines, including that it safeguards the sovereignty and rights of Gibraltarians.
Shadow foreign secretary Priti Patel also questioned whether Spanish officers would be able to stop British citizens coming to stay in Gibraltar.
Lammy insisted the only difference to what Conservative ministers had previously been negotiating was the sovereignty clause, which he said would ensure there was no question over Gibraltar’s status.
The UK has had sovereignty over Gibraltar since 1713, although this is disputed by Spain, who claim the territory as their own.
Public opinion in Gibraltar, which has a population of around 32,000, is in favour of keeping British sovereignty. The most recent referendum, held in 2002, saw almost 99% of voters reject a proposal to share sovereignty with Spain.
The UK said there would also be full operational autonomy for the UK’s military’s facilities in Gibraltar, where the airport is run by the Ministry of Defence and hosts an RAF base.
Liberal Democrat spokeswoman Helen Maguire welcomed the agreement, while calling for Parliament to get the opportunity to scrutinise and vote on it.
However, Reform UK have described the deal as a “surrender”.
Deputy leader Richard Tice raised concerns Spanish border officials would have “an effective veto” on British citizens from the UK landing in Gibraltar.
Lammy clarified that if there was an alert in relation to an arrival Spanish border guards and police would work alongside Gibraltarian police.
An individual would have the right to legal advice and be able to either return to their country of origin or go to Spain to face questions.