Prior to ending his China visit, which came at a time when the Communist country's territorial island dispute with Japan is heating up, Panetta addressed officers and cadets of the People's Liberation Army.
China, while repeatedly issuing warnings to Japan over the island dispute, has also been highly critical of the U.S. "pivot" toward Asia.
"Our rebalance to the Asia-Pacific region is not an attempt to contain China," Panetta said in his speech, The New York Times reported. "It is an attempt to engage China and expand its role in the Pacific."
Among top Chinese officials Panetta met in Beijing was Vice President Xi Jinping, tipped to become China's next president and Communist Party general secretary during the country's once-a-decade leadership change later this year.
Xi's meeting Wednesday with Panetta was his first with a foreign dignitary after being absent from public view for about two weeks. His absence had raised much speculation in the country regarding his health and his political standing.
The official Xinhua news agency reported Xi told Panetta Japan's recent nationalization of the dispute Senkaku islands, also called Diaoyu in China, was a farce and urged Japan to stop any behavior that infringes upon China's sovereignty.
Xinhua said it was the first time for Xi to comment on the dispute since the recent developments.
Xi also called on the United States to act in the larger interest of regional peace and stability, mind its words and actions, not get involved in issues regarding the sovereignty of the Diaoyu Islands, and refrain from doing anything that might escalate tensions or complicate the situation, Xinhua said.
Writing in Thursday's China Daily, Wang Xiaoxuan, director of the PLA's Naval Research Institute, said the island dispute could spiral out of control if Tokyo did not chart a new course and China should make all preparations "including preparations for a possible military conflict and even war."
"The resurrection of militarism within Japan is inseparable from the U.S. To maintain its global hegemonic status since World War II and defeat the erstwhile Soviet Union, the U.S. sought to strengthen and cultivate Japan as an ally," the article said.
The author wrote the United States, while largely responsible for the China-Japan islands entanglement, should have maintained an impartial stance and sought to help resolve the dispute.
During his Asia visit, Panetta stressed the United States would not take sides on the island dispute and urged a peaceful, negotiated resolution.
In his meeting with Xi, Panetta told the Chinese leader their countries are two great Pacific nations with common concerns.
"We want to begin what you have called a 'new model' relationship, and we can begin with better military-to-military relations. I am convinced that we will be able to improve our dialogue," Panetta said.
Notable deaths of 2014 [PHOTOS]