The season finale of “American Idol” on ABC was the top-rated show in the Monday overnight ratings, marking the first time since the show moved to ABC that it has won the night.

“American Idol” also narrowly topped NBC’s “The Voice” for the first time, though the comparison is an imperfect one as they did not air head-to-head for both hours of their respective broadcasts.

Airing from 9-11 p.m., “American Idol” averaged a 1.6 rating in adults 18-49 and 8.7 million viewers. That is up both from Sunday night’s part one of the finale, which drew a 1.3 and 7.5 million, as well as the last Monday episode of “Idol,” which aired on April 23 and drew a 1.4 and 7.6 million. This week was also the largest audience the show drew this season on a Monday night.

Airing from 8-10 p.m., “The Voice” drew a 1.5 rating and 8.6 million viewers, down slightly in the demo from last week’s episode. In the 9 p.m. time slot, when both shows aired against each other, they tied in the demo with a 1.5 each.

Earlier on ABC, the finale of “Dancing with the Stars: Athletes” (1.1, 8.7 million) ticked up in both measures from last week.

After “The Voice,” “Running Wild with Bear Grylls” (0.7, 3.1 million) ticked down.

On CBS, the finale of “Man With a Plan” (1.0, 5.7 million) was even. A new episode of “Elementary” (0.5, 4.2 million) was down in the demo.

Fox aired only the 2018 Miss USA pageant, which drew a 0.6 and 2.4 million viewers, down from a 0.8 and 3 million last year.

For The CW, “Supergirl” (0.5, 1.8 million) ticked up in viewers. “iZombie” (0.3, 1.1 million) hit a season high in viewers.

ABC won the night with  1.5 and 8.7 million viewers. NBC was second with a 1.2 and 6.8 million. CBS was third with a 0.8 and 5 million. Fox was fourth with a 0.6and 2.4 million. The CW averaged a 0.4 and 1.4 million.