Updated

Demi Lovato rocked out her latest hit “Give Your Heart a Break” during the first part of “The X Factor” finals on Wednesday night.

The singer was joined on stage by Simon Cowell’s remaining group, Fifth Harmony, for an over-the top duet.

“This is what I call pop perfection,” Cowell told Lovato and the all-girl group with a huge smile on his face.

“It was so much fun,” Lovato added. “These girls are so easy to work with. So down to earth so sweet and I love them.”

“The X Factor” co-host Mario Lopez was also highly impressed with the performance.

“You sounded like 6th harmony up here,” he said.

Other memorable moments in the show included a tribute to the slain children of the Sandy Hook shooting in Connecticut, where all top 16 performers participated.

The final three contenders left, Carly Rose Sonenclar, Tate Stevens and Fifth Harmony each performed three songs: one from the season, a celebrity duet and song that would have a “lasting impression” on the judges and on America.

Sonenclar,13, who has been mentored by pop princess Britney Spears took on Nina Simone’s “Feeling Good” as her Song of the Season.

The schoolgirl, who wore leather pants and a white cowboy-looking hat, performed her audition song again, which the judges really enjoyed but said it was not as impactful as when she performed it during her audition the first time around.

“I think it's so cool to see somebody so young be able to command the stage,”
said Lovato, adding that it is nice to see her “inspire so many young girls to follow their dreams.”

“We’re going to win this!” Spears added.

Singer LeAnn Rimes took the stage with Sonenclar and crooned to “How Do I Live” for her duet and then sang Leonard Cohen’s “Hallelujah.”

“You've had a good night,” said Cowell.

"I feel like that song alone is worth $5 million, so get our your check book,” Spears told Sonenclar.

Country music singer Tate Stevens chose Randy Hauser’s “Anything Goes”
for his song of the season.

“When you go straight down the middle country, you are right on,” said Lovato, adding that it was a “stadium performance.”

Simon Cowell agreed and said the performance was “made in America.”

Stevens then sang “Pontoon” with country music group Little Big Town and “Tomorrow” by Chris Young.

Fifth Harmony performed British electronic singer Ellie Goulding’s “Anything Could Happen.”

The song, which is fitting to the group since they are the underdog in the competition, was a hit for the judges.

“[It was] “spectacular, girly and fun,” said Spears.

After singing with Lovato, the group performed the Beatles classic, “Let It Be.”

[It’s like magic happening before our eyes,” said music executive L.A. Reid.

“You're five great singers and it's really important to remember that," Cowell added.

The winner of the second season of “The X Factor” will be crowned on Thursday.