US President Donald Trump claimed a personal victory at a NATO summit on Thursday after telling European allies to increase spending or lose Washington's support.
The ultimatum reportedly forced leaders to huddle in a crisis session with the U.S. president.
Afterwards Trump declared his continued commitment to a Western alliance built on U.S. military might that has stood up to Moscow since World War Two.
People present said he had earlier warned he would "go it alone" if allies, notably Germany, did not make vast increases in their defence budgets for next year.
"I let them know that I was extremely unhappy," he said, but added that the talks ended on the best of terms: "It all came together at the end. It was a little tough for a little while."
German Chancellor Angela Merkel, who called the summit "very intense", and other leaders including French President Emmanuel Macron, played down the extent to which they had pledged to accelerate spending plans as fast as Trump wanted.
"He said they must raise spending by January 2019 or the United States would go it alone," one person said of the clash at NATO headquarters.
Macron and others said they did not interpret Trump's words as a direct threat to quit the alliance Washington founded in 1949 to contain Soviet expansion.
Trump, asked if he thought he could withdraw from NATO without backing from Congress, said he believed he could but it was "unnecessary".
Others say Congressional approval would be required - and would be unlikely to be forthcoming.
Trump hailed a personal victory for his own strategy in complaining loudly that NATO budgets were unfair to U.S. taxpayers, and the emergence of what he said was a warm consensus around him.
Several diplomats and officials said, however, that his undiplomatic intervention - including pointing at other leaders and addressing Merkel as "you, Angela" - had irritated many.
As the drama unfolded NATO Secretary General Jens Stoltenberg cleared the room of many officials and the invited leaders of non-members Georgia and Afghanistan so that the other 28 leaders could hold a closed session with the president.
Stoltenberg said: "We had a very frank and open discussion... That discussion has made NATO stronger. It has created a new sense of urgency."
"A clear message from President Trump is having an impact."
NATO members have committed to spend at least two percent of their national income on defence by 2024, though the terms allow for stretching that in some cases to 2030.
The United States, far the biggest economy, spent 3.6 percent last year, while Germany, the second biggest, paid out just 1.2 percent and only a handful of countries met the 2 percent target.
Trump told leaders he wanted them all to hit that target by January, prompting consternation.
Many have already settled their 2019 budgets and the sums involved are immense - even if they wanted to, many would struggle to make useful purchases.
Merkel told reporters there followed a discussion with assurances to Trump that spending was increasing - something he later acknowledged was happening at an unprecedented rate.
"The American president demanded what has been discussed for months, that there is a change in the burden sharing," Merkel said. "I made clear that we are on this path. And that this is in our own interests and that it will make us stronger."
Asked when exactly the allies would now reach their two percent of GDP target, Trump said it would be over the coming years. Macron said France, which last year spent 1.8 percent on defence, would meet the target by the 2024 deadline.
Italian Prime Minister Giuseppe Conte said flatly that he agreed "no increase in spending" beyond that previously agreed by Rome, which last year spent 1.1 percent on defence and is labouring under heavy debts that severely limit its options.
Spanish Prime Minister Pedro Sanchez, who like the summit host, Belgian Prime Minister Charles Michel, was singled out in the room by Trump for spending less that 1 percent of GDP on defence, said Madrid would also meet the target by 2024.
"We have a very powerful, very strong NATO, much stronger than it was two days ago," Trump said.
"Secretary Stoltenberg gives us total credit, meaning me, I guess, in this case, total credit. Because I said it was unfair."