The agreement was signed last night by Obama and Karzai in Kabul, where the US president made an unannounced visit.
"That we can look beyond this period of transition is a tribute to the significant gains our forces have made, and the extraordinary growth in capability of the Afghan national security forces," he said.
"The United States of America and Afghanistan are more secure today because of the service and sacrifices of these brave heroes, and we will be more secure thanks to the enduring partnership that President Obama and President Karzai have signed. There will be more challenges ahead, but our strategy is succeeding," Panetta said.
The agreement, he said, affirms the long-term commitment of the United States to Afghanistan, and it is a further expression of their shared goal of defeating the Al Qaeda and its extremist affiliates.
"It is a tangible sign of the strength and the resilience of the partnership that has been built between the United States and the Afghan people, and the significant progress that has been made by American, international and Afghan forces in building an Afghanistan that can secure and govern itself. The transition to Afghan security lead has commenced and it is on track," Panetta said.
Obama in Kabul on Osama's death anniversary, inks pact
MUST READ: The MOST nail-biting moments of Osama raid
Goal to defeat Al Qaeda within reach, says Obama
In PHOTOS: Abbottabad, a year after the Osama raid
Hamid Mir: How Obama fulfilled Osama's dreams