In a gamble to save an embattled Atlantic City, the governor essentially legalized online gaming yesterday — paving the way for bets being placed via a computer from anywhere in the Garden State.

The first online bets could be placed sometime in September, insiders predict.

Gov. Christie’s okay came after he vetoed on online gambling measure for the second time in less than two years — but this time with certain conditions that he and lawmakers agree on.

“The conditions are minor changes,” state Sen. Raymond Lesniak, a sponsor of the bill, said in a phone interview, talking about the governor’s insistence that the law expire after 10 years and that funding for programs to help gambling addicts get pumped up.

Gov. Christie also insisted on boosting the tax on online gambling winnings to 15 percent from 10 percent.

“This is going to be wildly successful, and it’s going to bring in millions of dollars of additional revenues for the casinos and the state,” the Democratic lawmaker added.

As word of the conditional veto spread from Trenton to Wall Street, shares of Caesars Entertainment, which operates three AC casinos, including Harrah’s, soared 18.6 percent, to $10.07.

“Now is the time for our state to move forward, again leading the way for the nation, by becoming one of the first states to permit Internet gaming,” Christie wrote in a statement. “While Atlantic City’s reputation and stature as one of the premier resort destinations on the East Coast are well-chronicled, it is no secret that revenue from the region’s most important industries, gaming and tourism, has been in decline.

New Jersey will be the third state to legalize online gambling — after Nevada and Delaware passed similar laws.

Lesniak is now in the courts, fighting the National Football League over a bill Gov. Christie has signed allowing sports betting only at casinos and race tracks.

Briefs in the case have been filed, and the lawmaker believes there is a 50-50 chance the judge rules in his favor.

New York is moving forward with its own gaming initiatives. Albany will likely vote this year on whether to legalize brick-and-mortar casinos outside of racetracks.