America’s top military commander in the region, Gen Kenneth McKenzie, said the last C17 aircraft left Kabul with the US ambassador on board soon after midnight local time on Tuesday.
He added that the diplomatic mission to assist those who weren’t able to leave before the deadline would continue.
Celebratory gunfire by the Taliban was heard after the last plane departed.
The departure of that last aircraft signifies the end of America’s longest war, and a massive evacuation effort that began on 14 August soon after the Taliban took over the country.
Gen McKenzie said that in total, US and coalition aircraft evacuated more than 123,000 civilians – an average of more than 7,500 civilians per day during that time.
Speaking after the announcement, US Secretary of State Anthony Blinken spoke in Washington, calling the evacuation a “massive military, diplomatic and humanitarian undertaking” and one of the most challenging the US has ever carried out.
“A new chapter has begun,” he said. “The military mission is over. A new diplomatic mission has begun.”
But he said that the Taliban needed to earn its legitimacy and would be judged on the extent to which it fulfilled its commitments and obligations to allow civilians free travel to and from the country, protected the rights of all Afghans including women, and prevented terror groups from gaining a foothold in the country.
He added that while the US had suspended its diplomatic presence in Kabul, transferring operations to Doha, it would continue its “relentless efforts” to help Americans, and Afghans with US passports, to leave Afghanistan if they want to.
Mr Blinken was the first member of the Biden cabinet to talk about the withdrawal.
President Joe Biden issued a short statement thanking all those involved in the evacuation operation over the last 17 days and saying he would address the nation later on Tuesday.
Meanwhile, the US has yet to explain reports that a US drone strike on a suspected suicide bomber in Afghanistan killed a number of civilians, including six children and a man who worked as a translator for US forces.
Relatives said the strike, on a car near Kabul airport, was based on wrong information. The Pentagon said it was assessing and investigating the reports.