"I'm sorry, I don't even know what to feel right now. This is crazy," said a stunned Allen, 23, of Conway, Ark.
The contest came down to "city slicker' vs. "'tween dream," observed Early Show national correspondent Hattie Kauffman.
As host Ryan Seacrest said in announcing the result of the viewer vote, "The underdog, the dark horse, comes back and wins the nation over."
Lambert's commanding vocal range and stage presence - and the judges' adoration of him - at times turned "Idol" into "The Adam Lambert Show," with the other contestants mere guests. But it turned out that "Idol" viewers could embrace a gifted performer like Lambert, one who sported black nail polish and bold self-assurance, only to a point.
Simon Cowell tipped his hat to both contestants Wednesday.
"To both of you, and I don't normally mean this, I thought you were both brilliant. .... The future's all yours," the judge said.
But, "Being 'Idol' doesn't guarantee success," Kauffman pointed out. "The winner has to compete with established, big-name stars."
And often, those who don't come out on top in "Idol" fare better afterwards thanthose who do.
Asked by Kauffman what's next for him, Lambert replied, "An album. Music videos. A tour. Who knows?"
Before the results were announced, Lambert and Allen had a moment of musical camaraderie: They joined together with Queen on the rock anthem "We Are the Champions."
"Adam did win. So did Kris. Nobody lost tonight. These are two champions," said Paul Stanley from Kiss backstage.
The outcome echoed last year's contest, when Cowell all but crowned David Archuleta after the performance finale - but the victory went to David Cook.
Lambert's triumph was never inevitable. When Allen and Lambert were declared the finalists last week, just 1 million viewer votes separated the pair out of 88 million cast.
Allen bloomed during the season, gaining more assurance onstage and winning viewers over with his smooth, heartfelt vocals, modest demeanor and well-scrubbed good looks.
There was also the Danny Gokey factor. Gokey made it to the top three before he fell out of the contest, leaving his supporters up for grabs.
"After the third one leaves, you wonder where do the votes go from that third contestant," Paula Abdul said backstage after Tuesday's singing showdown.
Allen seemed the likely candidate for those viewers' affections, for on- and offstage reasons. Allen and Gokey, 29, of Milwaukee, were downright conservative when compared to Lambert's elaborate staging and wardrobe choices. Allen is a married college student and has worked as a church worship leader. Gokey, a widower, is a church music director.
Lambert, 27, of Los Angeles, brought measured rock flashiness - daring, not freaky - with songs including "Whole Lotta Love," the first-ever Led Zeppelin tune on "Idol." He's largely kept his personal life under wraps, saying "I know who I am" when asked about it.
Earlier this week, Allen said he hoped the outcome wouldn't be decided by "having the Christian vote."
"I hope it has to do with your talent and the performance that you give and the package that you have. It's not about religion and all that kind of stuff," he said.
Added Lambert: "It's about music. That's really important to keep in mind."
The finale Wednesday included the usual bag of tricks for extending the show to two hours and delaying the result until the final minutes. There were group numbers, the Golden Idol Award - semifinalist funnyman Nick "Norman Gentle" Mitchell among the contenders - and celebrity-contestant combos.
Allen was joined by Keith Urban on "Kiss a Girl," while Lambert performed with Kiss. The female finalists, including Allison Iraheta, opened up for Fergie, who sang "Big Girls Don't Cry" and then was joined by her group, the Black Eyed Peas.
Iraheta later dueted with Cyndi Lauper on "Time After Time" and Danny Gokey joined Lionel Richie for two tunes.
Rod Stewart sang "Maggie May" after the male finalists opened for him with "Do Ya Think I'm Sexy."
An offbeat guest was Steve Martin, the actor-comedian who also specializes in the banjo. He played his song "Pretty Flowers" with finalists Megan Joy and Michael Sarver on vocals.
Asked by Seacrest to guess who might win "American Idol," Martin replied: "I know it's a long shot, but I'm hoping I do."
Allen rose to the occasion during Tuesday's performance show, especially with his soulful version of "Ain't No Sunshine." But he was tripped up by "No Boundaries," a song co-written by judge Kara DioGuardi and ill-suited to his voice.
Lambert did a better job with "No Boundaries" and excelled on his reprise of "Mad World" and on "A Change is Gonna Come."
"That was the best I've ever heard you sing - ever!" exclaimed Abdul.