NATO leaders will formally invite Finland and Sweden to join the alliance tomorrow after Turkey agreed a deal to drop its objections, NATO chief Jens Stoltenberg said.
"I'm pleased to announce that we now have an agreement that paves the way for Finland and Sweden to join NATO," he told reporters on the sidelines of a NATO summit in Madrid.
"Turkey, Finland and Sweden have signed a memorandum that addresses Turkey's concerns, including around arms exports, and the fight against terrorism," he added.
Turkey's President Recep Tayyip Erdogan's office said that the country "got what it wanted" from Sweden and Finland before agreeing to back their drives to join NATO.
"Turkey has made significant gains in the fight against terrorist organisations," said the Turkish statement, adding: "Turkey got what it wanted."
US President Joe Biden congratulated Turkey, Finland and Sweden on their deal.
Sweden's Prime Minister Magdalena Andersson hailed a "very good agreement" with Turkey to back Swedish and Finnish membership in NATO and said the move would make the alliance stronger.
"Taking the next step toward a full NATO membership is of course important for Sweden and Finland.
"But it's also a very important step for NATO, because our countries will be security providers within NATO," Ms Andersson told AFP in an interview.
She rejected claims that she had conceded too much to Turkish President Recep Tayip Erdogan in order to convince him to drop his veto to Stockholm's membership.
"I think this is an agreement that I can stand fully behind," she said after lengthy talks in Madrid with Mr Erdogan and her Finnish counterpart.
She insisted that Swedish authorities were working on extradition requests from Turkey in accordance with Swedish legislation and a European convention on extradition.
Ms Andersson said she expected NATO leaders meeting tomorrow in Madrid to formally agree to invite Sweden and Finland to join the alliance without any surprises.
But she conceded the process to become full members could take some time and throw up more hurdles.
Finnish President Sauli Niinisto told reporters the trilateral memorandum that Turkey, Finland and Sweden signed today to confirm Turkish support for the Nordic countries' bid to join NATO does not list individuals for extradition.
Mr Niinisto said the memorandum, which will be made public only later, describes principles for extraditions related to terrorism, not individual citizens.
Meanwhile the United States said that no concessions were given to Turkey to secure its green light for Swedish and Finnish entry into NATO at the start of the alliance's summit in Madrid.
"There was no request from the Turkish side for the Americans to make a particular concession," a senior administration official told reporters.
Speaking on condition of anonymity, the official called Turkey's decision a "powerful shot in the arm" for NATO unity.
Turkey is an important NATO member in a strategically sensitive location, but it has had often tense relations with its European partners and Washington, which is the alliance's main military force.
A plan to equip Turkey with state-of-the-art US F-35 stealth fighters fell through after Turkey bought Russia's S-400 anti-aircraft missile system, something Washington saw as potentially threatening the security of the F-35 programme.
Turkey next set out to buy new F-16 fighter jets, as well as upgrades for its existing fleet of the same planes.
However, that deal is also on hold and there has been speculation that Turkey was holding up the NATO accession bids of Finland and Sweden to try and leverage US concessions.
"There's nothing the United States offered in direct connection with this," the US official said.
According to the official, it was Joe Biden who, soon after Russian invaded Ukraine in February, "reached out" to Finland and Sweden "to begin discussions" about them joining the transatlantic alliance.