"As we reflect on this moment, it is an opportunity to recognize that the surge accomplished its objectives of reversing Taliban momentum on the battlefield, and dramatically increased the size and capability of the Afghan National Security Forces," Panetta said in a statement while visiting New Zealand.
The departure of the last surge troops brings the number of U.S. troops in Afghanistan to 68,000, officials said.
President Barack Obama announced the troop surge in a nationally televised address Dec. 1, 2009, before 4,000 cadets at the U.S. Military Academy at West Point, N.Y.
He said the resurgence of the Taliban Islamist militant movement in Afghanistan and the continued existence of al-Qaida across the border in Pakistan -- what he called a "cancer" on the region -- were direct threats to the United States.
But he vowed to start bringing U.S. forces home in the middle of 2011, saying the United States could not afford and should not have to shoulder an open-ended commitment.
Surge troops came largely from the U.S. Army's highly decorated 101st Airborne Division, known as the Screaming Eagles, an infantry division trained for air assault operations.
Fifty-seven percent of the almost 2,000 U.S. fatalities in Afghanistan have occurred since the surge began in January 2010, ABC News reported.
Some 10,000 troops returned from Afghanistan by July 2011, while the drawdown of the remaining 23,000 ended this month, Panetta's statement said.
Panetta said the surge "struck enormous blows against al-Qaida's leadership, consistent with our core goal of disrupting, dismantling and defeating al-Qaida and denying it a safe haven."
Panetta added, "It is important to underscore that even as our surge troops return home, there are roughly 68,000 Americans who remain in a tough fight in Afghanistan, alongside their NATO and Afghan partners.
"We are a nation at war," he said. "But the international community is also strongly united behind our shared strategy to transition to Afghan security control, which will be completed by the end of 2014."
NATO has agreed that all its combat troops would leave Afghanistan by the end of 2014.
Moore to attend retreat in to avoid Kutcher's wedding
'How to Train Your Dragon 2' releases 5-minute clip