"We must demonstrate to the people and to the Taliban that Afghan and ISAF forces are here to safeguard the Afghan people," Petraeus said at the International Security Assistance Force headquarters.
"We are in this to win, that is our clear objective," the new commander of 150,000 US and NATO forces said.
During the ceremony attended by hundreds of NATO and Afghan officials, Petraeus received two flags - one from the US and the other from NATO.
The change of command comes when the insurgents are at their strongest since the ultra-Islamic regime was ousted in late 2001.
"We are engaged in a tough fight. After years of war, we have arrived at a critical moment," he said.
"We must demonstrate to the Afghan people, and to the world, that Al Qaeda and its network of extremist allies will not be allowed to once again establish sanctuaries in Afghanistan from which they can launch attacks on the Afghan people and on freedom-loving nations around the world."
The four-star general took over from General Stanley McChrystal, who was dismissed for disparaging remarks about the White House's leadership of the US mission.
US President Barack Obama, US ambassador to Afghanistan Karl Eikenberry and special envoy to Afghanistan and Pakistan Richard Holbrooke all came in for harsh criticism by McChrystal's aides in a profile that appeared in Rolling Stone in late June.
The US-led international forces are suffering increasing losses amid growing worries about the failure of the Afghan government to bring corruption under control and face down the Taliban.
Petraeus, 57, made his mark in Iraq, where he successfully led the 2007 surge against militants and laid the groundwork for the US withdrawal of combat troops in August.
Obama and other US officials insist that the change in military leadership would not mean a change in US strategy for Afghanistan.
"My assumption of command represents a change in personnel, not a change in policy or strategy," Petraeus said Sunday.
"To be sure, I will, as any new commander should, together with ISAF, Afghan, and diplomatic partners, examine our civil-military effort to determine where refinements might be needed," he added.
Cameron unveils exit strategy
Describing Afghanistan as his “biggest challenge”, Prime Minister David Cameron on Sunday unveiled his exit strategy from the war-torn nation, saying the British forces should be out from there by 2015, PTI reports from London.
While the Prime Minister said combat troops should be out by 2015, he said there would continue to be a diplomatic presence in the war-stricken country. And he said the British forces could remain in the region after 2015 to train the Afghan police and soldiers.