LOS ANGELES — The dragon did it one last time.

HBO’s “Game of Thrones” made television history at the 71st Primetime Emmy Awards on Sunday, winning for best drama series and tying the record for the most wins in that prestigious category with predecessors like “The West Wing,” “L.A. Law,” “Mad Men” and “Hill Street Blues.”

The sprawling fantasy series, which had its finale in May after eight seasons of blood and intrigue, won 12 Emmys for its swan-song season, adding to its record total for the most wins of any television drama ever.

The night was also huge for Amazon, which won the best comedy award thanks to “Fleabag,” a series that grew out of a 2014 one-woman show by its creator, Phoebe Waller-Bridge.

Waller-Bridge won three Emmys on the night, including for best actress in a comedy, a win that came as an upset. The much-decorated Julia Louis-Dreyfus, the star of “Veep,” failed to win that award for the first time in the show’s seven seasons. Waller-Bridge also won in the category of best writing for a comedy series.