LOS ANGELES (Reuters) - Television drama "Breaking Bad" won the top Primetime Emmy award for the first time on Sunday, just as the gritty tale of a chemistry teacher turned meth cook and drug kingpin winds down to widespread acclaim.

Although it won best drama series for its fifth season, AMC's "Breaking Bad" has just one episode left to air next Sunday in its sixth and final season. Its creators credited a changing television world of binge-watching, video on demand, online streaming and social media buzz for its success Sunday.

"I don't think our show would have even lasted beyond season two if it wasn't for video on demand, and also the Internet component of it where folks get to chat," "Breaking Bad" creator Vince Gilligan said backstage. "It really has held us in good stand. It's a bold new era."

If the best drama nod vindicated the gritty power of basic cable, the best comedy series award honored the slick production values of the broadcast networks. ABC's "Modern Family," a highly stylized show about unconventional families, won the top comedy award for the fourth consecutive year.

The Emmys are handed out by the Academy of Television Arts and Sciences and in a nod to the changing times, host Neil Patrick Harris made much of the latest trends in television viewing. He opened the ceremony enclosed in a room, binge-watching on multiple screens to catch up on every episode.

"Right now, I am watching an episode of 'American Horror Story: Asylum' on my contact lens," Harris joked with the audience at the Nokia Theatre in Los Angeles.

The newest player in the television industry, online streaming company Netflix Inc, failed to score wins in best drama and best acting categories for its political thriller "House of Cards." But it took home an award for directing and was a topic of conversation backstage as competitors lauded its ability to break ground on original programming for online streaming.

Premium cable veteran HBO, which led the field with 108 of the more than 500 nominations, proved its staying power in the increasingly competitive television industry, where basic cable and Netflix have challenged its high-quality production.

Jeff Daniels, who plays a jaded anchorman in HBO's "The Newsroom," scored an upset win for the best actor in a drama, while Claire Danes clinched her second consecutive best drama actress Emmy for her role as a bipolar CIA agent in "Homeland."

Daniels beat front-runner Bryan Cranston, who was looking for this fourth best actor Emmy in his role as unlikely drug kingpin Walt White in "Breaking Bad," and Kevin Spacey, who made waves as a cutthroat congressman in "House of Cards."

"I didn't expect this," Daniels said. "I usually don't win anything. The last thing I won was for 'The Squid and the Whale,' best actor over 50 from the AARP. With all due respect to the AARP, this is better."

Danes proved to be the only repeat winner in the major categories for Showtime's domestic terror thriller "Homeland," which won the trifecta of best drama series and best actor and actress for drama last year for its freshman season.

Its third season begins next Sunday after a second season that critics said fell short of the high notes in its first year.

BINGE-WATCHING 'BREAKING BAD'

HBO also won the best miniseries/movie category with its slick Liberace program "Behind the Candelabra." Veteran actor Michael Douglas won best actor in that category for his portrayal of the pianist, besting his co-star Matt Damon, who played his young lover.

"You deserve half of this," Douglas told Damon. "Do you want the bottom or the top?"

The lead comedy acting awards were less of a surprise than the drama category.

Julia Louis-Dreyfus won the best comedy actress Emmy for the second year in a row for her role as hapless U.S. Vice President Selina Meyer on HBO's "Veep."

Jim Parsons picked up his third lead comedy actor win for his role as the nerdy and neurotic Sheldon Cooper on CBS' "The Big Bang Theory."

Some of the notable losers of the night were "American Horror Story: Asylum," the miniseries that led the field with 17 nominations but only picked up two awards, and HBO's medieval fantasy "Game of Thrones," which received 16 nominations overall and won two technical awards.

"Breaking Bad" had 10 nominations overall and won three awards. Good timing and a surge in binge-watching seemed to be on its side.

AMC split the final season of "Breaking Bad" in two. It enjoyed a surge in ratings and a crescendo of critical and social media buzz perfectly timed to when Emmy voters were casting their ballots.

The first six episodes of the eight-episode ending to Walter White's saga, released weekly starting in August, averaged 5.2 million viewers, more than double last year's audience, according to AMC.