Gov. Andrew M. Cuomo signed into law Tuesday a bill that greatly expands casino gambling in New York — including creating new video slot machine parlors in Nassau and Suffolk counties.

The plan authorizes four upstate casinos, which must also win approval in a statewide referendum this fall.

No matter the fate of the casino vote, the law allows Nassau and Suffolk counties to open one video-slot facility apiece. Each would have a maximum of 1,000 machines, which are known as video lottery terminals. Both counties had strongly backed a gambling bill as a way to boost county finances.

“The law will provide residents who now travel out of the county to recreate in gaming the opportunity to spend their money in their home county while bolstering educational and municipal services,” Nassau County Executive Edward Mangano said in a statement Tuesday.

“This legislation will allow Suffolk County to keep tens of millions of dollars on Long Island to provide relief to local taxpayers, school districts and create jobs,” said Vanessa Baird-Streeter, spokeswoman for Suffolk County Executive Steve Bellone.

Off-track betting corporations in Nassau and Suffolk would operate the video slot machine centers, officials said. Neither county has designated a site preference yet, though Nassau Off-Track Betting Corp. president Joseph Cairo said officials were discussing the OTB Race Palace in Plainview.

He said access and parking are key issues at the facility, but added: “Our primary focus right now is the Race Palace.”

Cuomo has touted the plan as a way to boost the upstate economy.

“This new law will bring the state one step closer to establishing world-class destination gaming resorts that will attract tourists to upstate New York and support thousands of good-paying jobs, as well as new revenue for local businesses,” Cuomo said in a statement.

The law sanctions four casinos in three upstate areas: Catskills-Hudson Valley, Capital Region and Southern Tier.