NEW YORK — “The Sound of Music” has the sound of a hit for NBC.

A total of 18.6 million viewers tuned to Thursday night’s live three-hour telecast of the Rodgers and Hammerstein musical, according to the Nielsen company.

It was NBC’s best Thursday average, excluding sports programming, since the series finale of “Frasier” aired in May 2004, and the most-watched nonsports night since the Golden Globes broadcast seven years ago, the network said.

“The Sound of Music Live!” starred Carrie Underwood in the role of Maria, with Stephen Moyer (“True Blood”) as Capt. Von Trapp. It was the first full-scale musical staged live for television in more than a half-century.

Viewers flocked to the broadcast, but TV critics sang some sour notes.

NBC was widely credited for trying something ambitious and risky, and Underwood was praised for braving the challenge, but her shortcomings were called out.

USA Today’s Robert Bianco noted that, without Underwood’s star power, the broadcast never would have happened, while adding, “the trouble is that with her, it wasn’t very good.”

“It’s impossible not to notice that she can’t act,” wrote The Washington Post’s Hank Stuever. “When Underwood spoke her lines, she was as flat as the label on a Swiss Miss package of cocoa.”

A cast album of “The Sound of Music Live!” is already on sale. A home-video edition goes on sale Dec. 17.