The US leader, taking part in an event on the sidelines of the annual UN General Assembly on the importance of civil society on Monday, was exchanging small talk at the end of his remarks.
In a recording taped by CNN, Obama is standing up after the event and asking the man next to him if he had given up smoking.
When the question is returned to him, Obama, in a light-hearted tone with a smile on his lips, said: "I haven't had a cigarette in probably six years. That's because I'm scared of my wife."
Usually known for his fit figure and healthy lifestyle, Obama has long had a weakness for cigarettes and depicted himself as a smoker in his memoir of his youth, "Dreams From My Father."
Obama's smoking habit and his efforts to quit became favorite topics in the US media from the time he started his campaign for the White House in the 2008 election.
In his first year in office, Obama described himself as "95 percent cured" from smoking but admitted he has occasionally "fallen off the wagon" in his efforts.
In December 2010, then White House spokesman Robert Gibbs said that Obama had not smoked for nine months and had been "stubborn" in trying to quit, despite the stress of the job.
First lady Michelle Obama, a campaigner for public health, has been open about her distaste for her husband's smoking but said that he never lit up in front of their two daughters.
In February 2011, she said that the president had not smoked for a year and that she was not giving him a hard time about the issue.
"When somebody's doing the right thing, you don't mess with them," she said.