BAGHDAD—U.S. airstrikes helped break a two-month siege by Sunni militants on a Shiite town on Sunday, in apparent coordination with ground attacks by Shiite militias, local civilian fighters and Kurdish troops.

The attacks around Amirli, about 100 miles north of Baghdad, helped to avert what had been one of the country's biggest looming humanitarian crises. Residents of the town of 17,000, most of them Shiite Turkmen, faced famine,...