In a surprising legal twist, Nevada this week became the first U.S. state to allow online gambling within its borders.

The fast legislative action was spearheaded by Gov. Brian Sandoval and other state officials in an effort to beat New Jersey to the punch to “remain at the forefront of gambling regulation,” thereby attracting more gambling and tourist activity to Nevada, the Associated Press reported.

But the move could also mean good things for struggling social-game developer Zynga Inc. (NASDAQ:ZNGA), which appealed to Nevada regulators last year in an attempt to transition its business into online real-money gambling.

Sandoval signed the bill into law on Thursday to legalize online gambling, calling the bipartisan legislative action “an historic day for the great state of Nevada” that will “usher in the next frontier of gaming” in the state. The new law comes in the wake of relaxed federal regulations against online gambling, which the U.S. Justice Department first noted in 2011 when it reversed its previous prohibition of the practice. Instead, federal regulations now technically permit online gambling, but only in states that OK specific legislation explicitly designed to allow it.

This could be the much-needed regulatory shift that Zynga needs to reverse its recent fortunes. As the company’s last two earnings reports indicated, it has struggled to transform its impressive player count across all its Facebook Inc. (NASDAQ:FB) and mobile games into a meaningful source of revenue.

Last year, Zynga and Facebook also adjusted a two-year-old contract between the two companies that gave Zynga a privileged position within the massive social network’s applications marketplace -- a subtle piece of corporate engineering that no doubt helped Zynga attract many of its users in the first place. That contract will expire March 31, but Zynga has already shed millions of users from its most popular Facebook games such as FarmVille 2, as it lost its top spot on the social-gaming ladder in January when rival’s game Candy Crush became the most popular Facebook game in terms of monthly active users.

Zynga already began to reconfigure itself as an online gambling company last fall when it recruited a veteran gambling executive as its new chief operating officer and partnered with the British Digital Entertainment PLC (LON:BPTY) to bring its games to less harshly regulated territories abroad.

But these have all been roundabout ways for the San Francisco-based company to target its desired audience of gambling-friendly online gamers in the U.S. With the prohibition against online gambling in an American state scrapped for the first time, Zynga’s new business model has been given a fresh dose of legitimacy and access to a segment of consumers much more willing and able to spend money on online games than the average FarmVille player.  

Zynga will still have its work cut out for it in the coming quarters, however. The new law allows for online gambling only within Nevada, which limits the potential reach that any Internet company can provide as a major selling point for its service. And the Las Vegas Review-Journal noted that Nevada’s law was written to block companies that have already amassed piles of user data from gaining any sort of “head start” against their competitors in the state.

Pete Ernaut, a Nevada Resort Association lobbyist quoted by AP, said expanding the customer base was key. “It’s imperative for the success of this that we compact with other states because we don’t have a universe of players,” Ernaut said.

This “compact” with other states, ironically enough, could actually turn Zynga into a competitor in the short run. But, in the long run, Nevada’s new law could spur competition between any number of states to OK online gambling and vie for the attention and support of established businesses such as Zynga’s. After all, New Jersey Gov. Chris Christie has already moved to reconsider his earlier veto of an online-gambling measure in his state.

Zynga may still be caught in-between two tenuous businesses models for the time being, but relaxed laws and regulations can only provide it with new avenues for growth. Or at least that’s what investors think -- the company’s share price jumped 23 cents, or 7.77 percent, to close at $3.19 Friday.