NATO Secretary General Jens Stoltenberg told CNBC that if the U.S. is concerned about the rise of China then it was "even more important to maintain NATO to keep your friends and allies close."

The head of the North Atlantic Treaty Organization was responding to U.S. Defense Secretary Mark Esper's speech at the Munich Security Conference on Saturday, in which he called China a rising threat to the world order.

Stoltenberg acknowledged that the global balance of power was shifting with the rise of China, pointing out that it now has the second-largest defense budget in the world and that it's "investing heavily in new military capabilities."

The alliance put the issue of China on its agenda for the very first time at an event in London in December. At the time, Stoltenberg told CNBC that the rise of the Asian powerhouse provided some "obvious opportunities but also some obvious challenges."

In March 2019, China set its 2019 defense spending 7.5% higher than a year ago, raising it to 1.19 trillion yuan ($177.61 billion), according to known figures (some believe the actual figure could be higher). This still lags behind U.S. spending, however, with its Defense Department having asked Congress for $718 billion in its fiscal 2020 budget.

Stoltenberg said Saturday that the "important message" for the U.S. was that if it was concerned about China then it needed its allies. "Together with Europe and Canada we represent 50% of the world's military might and 50% of the world economy. Together we are strong," he told CNBC's Hadley Gamble.