NBC’s star-studded “Saturday Night Live” anniversary special on Sunday scored some of the network’s best ratings for an entertainment telecast in years, drawing numbers that were pretty close to what CBS did one week earlier with the Grammys. The Peacock easily beat its combined ABC-CBS-Fox competition during primetime.

According to preliminary national estimates from Nielsen, “SNL 40th Anniversary Special” averaged a 7.8 rating/21 share in adults 18-49 and 23.1 million viewers overall from 8 to 11 p.m., preceded by an hourlong red-carpet special that performed nicely as well (3.0/10 in 18-49, 11.1 million viewers overall).

The 7.8 rating is the best for any NBC primetime entertainment telecast (excluding post-Super Bowl programs) since the “Will & Grace” finale in May 2006, and the 23.1 million total viewers is the net’s best since the night of the “Frasier” finale in May 2004.

And among all “SNL” primetime specials, last night’s is the highest-rated in 18-49 since a February 2001 edition following an episode of “Friends” (9.3) and the most-watched overall aince a “SNL Presidential Bash” in November 1992 (28.8 million).

The ratings for the “SNL” special, which could come down a bit in the nationals once the final 30 minutes are included, were in the vicinity of the previous week’s Grammy Awards on CBS (8.3/23 in 18-49 and 24.8 million viewers overall ) and about what NBC averaged in the fall with its high-rated NFL “Sunday Night Football” package.

For the night, NBC’s 6.6 rating/19 share in 18-49 and 20.1 million viewers overall crushed the combined totals of its Big Four rivals ABC, CBS and Fox (3.4/9 in 18-49, 15.7 million viewers overall).

On the social media front, a total of 9.1 million people in the U.S. saw 1.3 million Tweets about the “SNL 40th Anniversary Special” on Sunday, according to Nielsen. These Tweets were sent by over 449,000 people and generated 188 million Twitter TV impressions.

ABC placed second among the broadcasters Sunday in 18-49, kicking things off with its 25th anniversary special of “America’s Funniest Home Videos” (1.4/5 in 18-49, 6.6 million viewers overall). It was followed by the “Bachelor” special “Chris Tells All” (1.5/4 in 18-49, 5.6 million viewers overall) centered around host Chris Harrison and a special original episode of “The Bachelor” from 9 to 11 (1.5/4 in 18-49, 6.0 million viewers overall).

CBS had the night’s most-watched series with “60 Minutes” (1.2/4 in 18-49, 10.4 million viewers overall) but couldn’t generate much opposite the “SNL” special with either its special “Undercover Boss” episode at 8 (0.9/3 in 18-49, 6.3 million viewers overall) or with its two-hour season finale of “CSI” at 9 (1.1/3 in 18-49, 7.0 million viewers overall).

Fox generated low numbers for its mostly original night of comedies, which opened with the finale of “Mulaney” (0.4/1 in 18-49, 1.1 million viewers overall) and an encore “The Simpsons” (0.6/2 in 18-49, 1.5 million viewers overall). A new “Simpsons” at 8 could only muster a 1.1/3 in 18-49 and 2.7 million viewers overall, and was followed by first-run episodes of “Brooklyn Nine-Nine” (0.9/2 in 18-49, 2.1 million viewers overall), “Family Guy” (1.2/3 in 18-49, 2.5 million viewers overall) and “Bob’s Burgers” (0.9/2 in 18-49, 2.5 million viewers overall).

TNT figured to place second on Sunday with its coverage of the NBA All-Star Game, early ratings for which weren’t available this morning. Saturday’s “All-Star Saturday Night” special averaged about 6.1 million viewers on TNT, a roughly 10% improvement over the previous year.

In Nielsen’s metered-market overnights, the basketball game did a 5.5 rating. The “SNL” special on NBC led the way with a 14.2.