LOS ANGELES — Kellie Pickler came into the final “Dancing With the Stars” episode in second place but finished in first.

The 26-year-old country singer won the show’s mirrorball trophy Tuesday.

Pickler and her professional partner, Derek Hough, earned two sets of perfect scores Monday night and another on Tuesday. Judges’ scores combined with viewer votes determine the winner.

Because there were problems Monday with voting on the ABC website during the show’s East Coast broadcast, host Tom Bergeron said Tuesday those votes weren’t counted. Only votes cast by phone, text and Facebook factored into the final count.

Teen Disney Channel star Zendaya came in second place. Football pro Jacoby Jones finished third. Fellow finalist Alexandra Raisman was axed at the beginning of Tuesday’s episode.

On Monday’s episode, Zendaya had been perfect in the judges’ eyes, earning the maximum score for each routine.

But Pickler had managed a close second, collecting perfect 10s for her quickstep and freestyle dances, but finishing behind Zendaya in the cha-cha relay, which saw all four finalists perform to the same song.

Pickler’s freestyle had brought judge Carrie Ann Inaba to tears.

“You just bared your soul on the dance floor and it was one of the most beautiful things I have ever seen,” Inaba said.

Raisman finished third after wowing the judges with a freestyle routine that incorporated gymnastics and stunts on vertical bars. Jones landed in last place.