US Defence Secretary James Mattis has told fellow NATO members to increase military spending by the end of the year, or risk seeing the US curtail its defence support.

The ultimatum came on Wednesday during Mattis' first visit to the NATO headquarters in Brussels, since he was sworn in last month.

"If your nations do not want to see America moderate its commitment to this alliance, each of your capitals needs to show support for our common defence," Mattis said.

He told the alliance's 27 other defence ministers to adopt a plan that sets dates for governments to meet a military funding goal of 2 percent of gross domestic product.

Mattis's message to his counterparts in Brussels follows years of demands by the US for allies to spend at least 2 percent of their GDP on defence, a goal that only a handful meet despite agreeing to it at a summit in 2014.

Currently, only the United States, Britain, Estonia, Greece and Poland have hit or surpassed the 2 percent figure.

READ MORE: EU nations react to Donald Trump\'s remarks

Asked about Mattis' ultimatum, NATO chief Jens Stoltenberg said that allies needed time to develop plans. Many are already talking about increasing commitments, he added.

Stoltenberg denied that Mattis's words amounted to a threat, saying it was a "firm message" and that his colleagues agreed that they would do more to contribute.

"That message is about the importance of fair burden-sharing. It reflects a political reality in the United States," Stoltenberg told a press conference.

Despite lambasting some NATO partners' spending, Mattis hailed NATO as the "fundamental bedrock" of transatlantic security as he sought to reassure allies about President Donald Trump's commitment to the alliance.

Even though, Trump had previously said the alliance was "obsolete" and that US help to NATO might depend on how much they have paid, since his inauguration, he has taken a more orthodox stance and reaffirmed the long-standing US commitment to the alliance.