“Game of Thrones” set a series record for total viewers with its season finale Sunday night with 8.1 million viewers, according to Nielsen. The HBO show’s previous record was the season premiere in April, which attracted eight million viewers. Last year’s season finale brought in 7.1 million viewers.

The rating for Sunday’s show, which completed the series’ fifth season, was especially strong considering the episode ran opposite Game 5 of the N.B.A. Finals, which drew 20.5 million viewers.

The season finale’s total viewership will jump higher in the next few weeks after more people watch it on DVR, HBO Go and HBO Now, the network’s streaming service. Two weeks after the season premiere, the viewership for that episode jumped from 8.1 million to more than 18 million, the cable network said.

Last year, “Game of Thrones” became HBO’s most-viewed show in its history.