Emma Stone

Actress Emma Stone attends a lighting ceremony at the Empire State Building with the cast of "The Amazing Spider-Man 2," which was shot entirely in New York. (Andy Kropa / Invision / May 3, 2014)

When director Marc Webb spoke to the big crowd at the premiere of "The Amazing Spider-Man 2" here, he didn't open by saluting the cast or welcoming the colorfully dressed fans at the Ziegfeld Theatre.

Instead, he gave thanks — to New York.

"We shot this all in New York, which is a great place to shoot a movie," Webb told onlookers, including delegates from the New York City Mayor's Office of Media and Entertainment. "I highly recommend it if you get the chance."

Tinsel Town is being upstaged by the Big Apple — in film location shoots, in TV shows and even in glitzy premieres like the one for "Spider-Man." The Tom Hanks thriller "Captain Phillips" and "Lee Daniels' The Butler" also debuted in the city, as did the new season of HBO's "Game of Thrones." Leonardo DiCaprio's "The Great Gatsby" premiered to a black-tie audience at Lincoln Center, followed by a Roaring '20s-themed party at The Plaza with giant flaming bottles of Moet.

What's happening on the red carpet mirrors what's happening on film sets and TV soundstages. New York had a record number of film and TV projects last year and is on track to do the same in 2014, state officials say. Credit goes to generous financial incentives, experienced crews that rival Hollywood's best and friendly (some might say star-struck) politicians.

"There was a period of time when we lost our edge," said Kenneth Adams, chief executive of Empire State Development, the state's main economic development agency. "We've regrouped and come back stronger than ever."

The shift in television production is especially dramatic, and was underscored by NBC's decision last year to move the "Tonight Show" to Manhattan after decades in Burbank. That move was part of a larger trend — New York City is now home to 29 TV series, compared with seven a decade ago, according to the Office of Media and Entertainment.

This summer New York City will debut its biggest-ever TV production, a $200-million, 60-episode television series for Netflix based on the Marvel Defenders characters.

By comparison, Los Angeles has seen a sharp decline in its share of TV production, especially for one-hour dramas. During last year's pilot season, Los Angeles captured only 22% of all TV pilots for dramas, down from 63% in 2007, according to a study by FilmL.A. Inc.

Entertainment industry experts point to New York's incentives as the biggest reason for the state's growing film and TV production business.

The state of New York provides up to $420 million annually in rebates to the film industry — four times what California spends. New York's credit also covers big-budget movies and new network TV dramas that are specifically excluded from California's program.

"They are building on their innate strengths and really flourishing," said Assemblyman Mike Gatto (D-Los Angeles), who has co-authored a bill, AB-1839, that would make California's incentives more attractive. "We have to take some steps to compete."

Supporters of the bill have cited New York's success as a reason to bolster California's film program.

Last week, however, the California Legislative Analyst's Office said the program's fiscal benefits had been exaggerated and warned that expanding funding could lead to a "race to the bottom" competition among states for Hollywood's business.

"If the Legislature wishes to continue to expand the film tax credit, we suggest that it do so cautiously," the report said. "Responding to other jurisdictions' subsidies could be very expensive."

That language could be seen as lending credence to something filmmakers have been saying for a few years now: that New York is a more welcoming environment.

"They've made it really attractive, the way L.A. used to be," said Webb, whose movie was a bonanza for New York with a $200-million-plus production budget that employed 3,900 cast and crew members and 5,223 extras.

Much of the credit for revitalizing New York's entertainment industry goes to former Mayor Michael Bloomberg and his film commissioner, Katherine Oliver.

To make the city film-friendly, it provided free police assistance to crews and discounts to filmmakers using local vendors, and worked with a Brooklyn nonprofit group to train low-income New Yorkers as production assistants. A marketing credit provides free advertising in subways, buses and Taxi-TV for productions that make a donation to a local cultural institution.

All the activity has resulted in some grumbling from notoriously impatient New Yorkers who are increasingly forced to share streets and sidewalks with film crews. The‎ mayor's film office has seen its ranks thinned in the past few years as a result of budget cuts, and the city has a new film commissioner since Bloomberg left office.