LONDON — The secretary general of NATO expressed confidence on Friday that President-elect Donald J. Trump would not back away from America’s longstanding commitment to European security, even as the alliance’s chief acknowledged that the region needed to shoulder a greater financial burden for its own defense.

Mr. Trump raised alarm during the election campaign when he questioned whether the United States would automatically defend NATO allies if they were attacked. Mr. Trump said American support would depend on the willingness of those countries to pay their fair share for military protection.

He has also called NATO “obsolete” and said that the alliance was failing to fight terrorism.

Those allies not willing to pay for American military protection, he warned, could receive a stark message: “Congratulations, you will be defending yourself.”

But in his first speech since the election last week, Jens Stoltenberg, the NATO secretary general, said that he looked forward to meeting Mr. Trump soon and that he was certain Mr. Trump would not waver on the United States’ role in the alliance.