Undercover agents arrested a Somali-born teenager as he tried blowing up a van full of what he believed were explosives at a crowded Christmas tree lighting ceremony, authorities in the US said.
The bomb was a fake supplied by the agents in a sting operation and the public was never in danger, they added.
Mohamed Osman Mohamud, 19, was arrested in Oregon at 5:40pm local time shortly after he dialled a mobile phone that he thought would set off the blast but instead brought federal agents and police swooping down on him.
Yelling "Allahu Akbar!" - Arabic for "God is great!" - Mohamud tried to kick agents and police after he was taken into custody, according to prosecutors.
"The threat was very real," said Arthur Balizan, special agent in charge of the FBI in Oregon. "Our investigation shows that Mohamud was absolutely committed to carrying out an attack on a very grand scale."
The FBI affidavit that outlined the investigation alleges that Mohamud planned the attack for months, at one point mailing bomb components to FBI operatives, whom he believed were assembling the device.
It said Mohamud was warned several times about the seriousness of his plan, that women and children could be killed, and that he could back out, but he told agents: "Since I was 15 I thought about all this" and "It's gonna be a fireworks show ... a spectacular show."
Mohamud, a naturalised US citizen living in Corvallis, was charged with attempted use of a weapon of mass destruction, which carries a maximum sentence of life in prison. A court appearance was set for Monday.
Authorities allowed the plot to proceed in order to build up enough evidence to charge the suspect with attempt.
US Attorney Dwight Holton released federal court documents that show the sting operation began in June after an undercover agent learned that Mohamud had been in regular e-mail contact with an "unindicted associate" in Pakistan's north-west, a frontier region where al Qaida and Afghanistan's Taliban insurgents are active.