LOS ANGELES — The first “American Idol” finale in 2002 was a battle of the sexes, with Kelly Clarkson the victor over Justin Guarini. The last contest settled the score as Trent Harmon defeated La’Porsha Renae.

Harmon tumbled to the stage in surprise as host Ryan Seacrest announced him as the 15th and final winner of “American Idol,” which ended its remarkable run Thursday.

“I know that I have a God-given ability, but I didn’t want to take it for granted. I wanted to work so, so hard, and she pushed me to do it,” a tearful Harmon said of Renae, who stood poised and smiling by his side.

Harmon, 24, who described himself as just a “dude from Mississippi,” waited tables at his family’s restaurant in Amory before trying out for “American Idol.”

He won viewers over with his supple vocals and increasingly assured stage presence, and they voted him into history as the show’s last champion. Harmon earned a record contract along with the honor.

Renae, 22, also from Mississippi, the town of McComb, is a single mom who inspired viewers with her triumph over domestic abuse as well as a richly powerful voice.

“American Idol,” once a ratings powerhouse that influenced TV and music, had suffered steady audience erosion before Fox decided it would end this season.

Series executive producer Nigel Lythgoe promised the finale would celebrate its large ranks of contestants, not big-name guests as in previous years, and he stuck to that pledge.

The show opened with a harmonizing chorus of white-clad winners and contenders including Scotty McCreery, Taylor Hicks and Diana DeGarmo.

Other familiar faces from years past popped up in solos and group numbers, including Carrie Underwood, Jennifer Hudson, David Cook, Fantasia, Ruben Studdard, Jordin Sparks and Kimberley Locke.

Judges got in on the act as well. Keith Urban and Underwood dueted, while Harry Connick Jr. saluted a music center in New Orleans’ Katrina battered-Ninth Ward by inviting a young student, Marley Fletcher, to join him on “It’s a Wonderful World.” Jennifer Lopez performed her new single.

President Obama congratulated the show on its long run in pre-taped remarks.