As part of the deal, Gibraltar-based companies will be required to pay taxes in Spain if they conduct most of their business outside of Gibraltar. There are currently more than 55,000 Gibraltar-based companies, nearly double the number of registered residents.
Madrid considers the 30,000-strong territory a tax haven, where corporation tax is less than half of Spain's. Spanish Foreign Minister Josep Borrell says the new treaty, which requires parliamentary approval, is aimed at "preventing" Gibraltar becoming "a source of disloyal competition on taxation."
London and Madrid had not signed an equivalent international treaty since 1713, when Gibraltar's control was ceded to Britain. Borrell's ministry said that David Lidington, effectively Prime Minister Theresa May's deputy, is due to sign the treaty later in the day.
The treaty is part of a series of lower-level bilateral deals ahead of Brexit.
London's deputy mayor says Britain should stop the clock on its exit from the European Union, then hold a second referendum about any deal negotiated with Brussels.
Rajesh Agrawal, London's business czar, told The Associated Press that with just 25 days left to go before Britain's scheduled divorce from the EU and with many terms of the divorce still unclear Brexit, "we need to take the pressure off."
He said this could be done by revoking Article 50, which formally triggered the Brexit process, "and then we go back to the people for confirmation. Because it's only right and democratic to let the people have the final say."
Agrawal spoke at an outreach office for London in Berlin that's intended to boost cooperation between the British and German capitals.
Officials from the European Union and Britain are set to resume discussions on how to break the Brexit deadlock, less than four weeks before the country is scheduled to leave the bloc.
EU officials said Michel Barnier, the EU's chief Brexit negotiator, will meet with Britain's Brexit Secretary Stephen Barclay and Attorney General Geoffrey Cox.
Britain is due to leave the EU on March 29, but the British Parliament has so far rejected a deal between the EU and the government of British Prime Minister Theresa May, raising the prospect of a chaotic, economically damaging departure from the bloc.
The main point of discussion centers on a provision to ensure no border posts go up after Brexit between EU member Ireland and Northern Ireland, which is part of the United Kingdom.
British opposition politicians are accusing Prime Minister Theresa May of trying to bribe them into voting for her Brexit deal.
The government on Monday announced a 1.6 billion-pound ($2.1 billion) package of funding over several years to help regenerate run-down communities.
Many are in areas of England represented by the opposition Labour Party, and the move is being seen as a bid to win support from their lawmakers for May's withdrawal agreement with the European Union.
Britain is due to leave the EU on March 29, but Parliament has so far rejected May's deal, raising the prospect of a chaotic, economically damaging departure from the bloc.
Labour lawmakers reacted coolly to the announcement. Chris Bryant called the money "corrupt, patronizing, pathetic" and "all to appease the Brexit monster."