Taliban spokesman Zabiullah Mujaheed said six militants were sent to target the president, and three them died. He said they were armed with guns, rockets and suicide vests although no suicide bombings were reported.
The initial moments of the attack, which came as a marching band played the national anthem, were broadcast live until TV transmissions were cut. Hundreds of dignitaries could be seen diving for cover.
Less than two hours later, Karzai appeared on state-run TV and said "everything is OK." Appearing calm and smiling, Karzai said "the enemy of Afghanistan" tried to disrupt the ceremony but was thwarted. He said several suspects were arrested.
The live coverage of the assassination attempt will add to the sense of insecurity in the Afghan capital, which has been spared the worst of the violence as fighting has escalated between Taliban insurgents and NATO and US-led forces. The attack raises questions about the ability of the intelligence service, police and army to provide adequate security in the heart of the city.
The fighting left about 8,000 dead last year, mostly militants in the south and east of the country, where Karzai's government has only a tenuous grip and little public support.
NATO Secretary General Jaap de Hoop Scheffer joined several foreign leaders, including neighboring Pakistan, in condemning Sunday's attack.
"The Taliban has demonstrated once again that they will use the most extreme violence to oppose Afghanistan's freedom and democratic development," de Hoop Scheffer said in a statement.
In eastern Afghanistan, US and Afghan army troops fought off coordinated insurgent attacks, leaving a dozen militants dead and a dozen others wounded, a US military statement said Monday.
As many as 40 insurgents attacked five military outposts on Sunday in Korangal Valley of volatile eastern Kunar province, using small arms fire, rockets and mortars, the statement said.
The joint force returned fire and called in airstrikes that left 12 militants dead and 12 others wounded, the coalition said. No US or Afghan soldiers were hurt.