"My truth is that I am a gay American," said James McGreevey, a married father of two. "Shamefully I engaged in adult consensual affairs with another man, which violates my bonds of matrimony. It was wrong, it was foolish, it was inexcusable."
Mr McGreevey said the fact that he was gay made little difference to his suitability for office, but added that keeping his affair and sexuality secret would have left the governor's office "vulnerable". Earlier this year he said he was opposed to gay marriage.
"Given the circumstances surrounding the affair and its likely impact upon my family and my ability to govern, I have decided the right course of action is to resign," he told a news conference, flanked by his wife Dina and his parents.
According to the Associated Press, a high-ranking official said that the man involved in the affair, a former government employee, had allegedly demanded "an exorbitant sum of money to make it go away".
A New Jersey Republican source told Reuters a lawsuit would be filed in the state alleging sexual misconduct by the governor against Mr McGreevey's former homeland security adviser, Golan Cipel.
Mr Cipel, an Israeli national, took the $110,000-a-year job in early 2002 but had to step aside after his credentials were questioned. The governor's long-time friend and former campaign aide was kept on in the office until August 2002.
Mr McGreevey's administration has been blighted by scandal since he took office two and a half years ago. Recently his biggest campaign contributor, the real estate developer Charles Kushner, was charged with trying to thwart a federal investigation into campaign finance by luring a grand jury witness - his brother-in-law - into a compromising position with a prostitute and sending video and photos to the man's wife.
Mr McGreevey, a former suburban mayor who won the race for governor by 15 percentage points in 2001, inherited a $5bn (£2.7bn) budget deficit in January 2002, but refused to boost income taxes for most New Jerseyans, instead raising taxes on millionaires, casinos and cigarettes.
Mr McGreevey's resignation will be effective from November 15. Another Democrat, Richard Codey, will serve out this term.
Two years ago, Mr McGreevey responded to a push by New Jersey gays for same-sex marriages by saying that changing the law would have a "detrimental impact".