NATO also agreed to formally treat Russia as the "most significant and direct threat to the allies' security", according to a summit statement.
"Today, we have decided to invite Finland and Sweden to become members of NATO," NATO leaders said in their declaration, after Turkey lifted a veto on Finland and Sweden joining.
Ratification in allied parliaments is likely to take up some time, but once it is done, Finland and Sweden will be covered by NATO's Article 5 collective defence clause.
"We will make sure we are able to protect all allies, including Finland and Sweden," Stoltenberg said.
In the meantime, the allies are set to increase their troop presence in the Nordic region, holding more military exercises and naval patrols in the Baltic Sea to reassure Sweden and Finland.
After four hours of talks in Madrid on Tuesday, Turkish President Tayyip Erdogan agreed with his Finnish and Swedish counterparts a series of security measures to allow them to overcome the Turkish veto that Ankara imposed.