US President Donald Trump, Danish Prime Minister Mette Frederiksen and Greenland's Prime Minister Jens-Frederik Nielsen signed the agreement on Tuesday, which amends and updates a 1951 defence agreement between Denmark and the US.
Trump said the US would "immediately begin the process of developing a large military presence in the appropriate locations".
Frederiksen described the deal as "good for the US, Denmark and Greenland" and also for Europe and Nato, while Nielsen called it a "win-win-win".
The signing appeared to resolve more than a year of tension sparked by Trump's earlier threats to "take" the semi-autonomous Arctic territory, citing national security concerns over its strategic defence location and mineral wealth.
Those statements drew sharp criticism from Greenlanders, Danes and European leaders, who issued a joint statement warning that Trump's rhetoric "undermine transatlantic relations and risk a dangerous downward spiral".
Under the new agreement, the US "shall be allowed to establish an additional Defence Area at Narsarsuaq and Mestersvig" — sites in Greenland's south and east respectively.
Narsarsuaq has deep-water access and a large runway, which US military engineers were reported by Danish media to have surveyed last week. Mestersvig is a remote, less developed outpost currently used by a Danish naval dog sled unit.
The deal stipulates that the "modalities and technical details" of the bases are yet to be confirmed and must be mutually agreed by all parties.
Washington already operates the Pituffik Space Base in north-western Greenland.