Barack Obama mocked his damaging "nap" in the first debate and Mitt Romney lampooned the president's jobs record on Thursday, as the White House foes cloaked hostility with humour at a fabled charity dinner.
Obama and his Republican foe mixed punchlines and self-mockery at the Al Smith Memorial Dinner in New York with a layer of collegiality barely disguising their bitter rivalry just 18 days before a razor's edge election.
The tuxedo-wearing candidates sat at the top table of the glittering white-tie affair, separated only by the Roman Catholic Archbishop of New York Cardinal Timothy Dolan, just two days after their latest acrimonious debate.
Romney got the first turn to speak and his debut zinger took a shot at his own wealth, saying it was nice for him and wife Ann, resplendent in a black and white dress with a cape, to slip into clothes they would wear around the house.
His speech, perhaps with more of a cutting edge than Obama's later remarks, joked his challenger had come up with a new slogan after good employment data this month: "You're better off now than you were four weeks ago."
Romney said Obama's presidency was in its final months, and said the Democrat, derided by some conservatives as a socialist, was looking around at the wealthy audience and thinking "so little time, so much to redistribute".
In his stand-up routine, Romney also took a shot at the media, which many Republicans think is biased towards Obama.
"My job is to lay out a positive vision for the future of the country. Their job is to make sure that no one else finds out about it."
Obama and Romney had earlier greeted one other, before the well-heeled crowd at the Waldorf Astoria hotel, with smiles and handshakes, but the reality of a closely contested race simmered below the surface.
The president also started out in self-deprecating tone, noting he had shown more energy in their second debate on Tuesday, than in his disastrous first effort two weeks ago.
"I was really well rested after the nice long nap I had in the first debate," Obama joked, before going on to poke fun at multi-millionaire Romney's bulging wallet after a career as a venture capitalist.
"I went shopping at some stores in Midtown, Governor Romney went shopping for some stores in Midtown," Obama joked.
The president, with his trademark beaming smile, also ribbed Romney for his gaffe-strewn foreign tour earlier this year, and noted that he was mocked as a celebrity in 2008 because he was so popular abroad.
"I am impressed with how well Governor Romney has avoided that problem."
Obama also noted that the unemployment rate, now at 7.8 percent, was at the lowest point of his presidency before adding: "I don't have a joke here, I just thought it'd be useful to remind everybody..."
But as is traditional at the dinner, in memory of former New York governor Smith, the first Roman Catholic to run for president in 1928, Obama and Romney both praised one another as honourable family men.
Before the jokes, President Obama sat down with Jon Stewart, host of Comedy Central's satirical The Daily Show and denied his administration had reacted with "confusion" to the attack on the US consulate in Benghazi, Libya.
The Democratic president, parrying Republican claims of a cover-up, said he had passed on information to Americans about the attack as soon as he had it, and promised to fix any security lapses it revealed.
Stewart also asked Obama about communications problems within his administration following the attack and also security issues, saying the US response to the tragedy had not been "optimal".
"When four Americans get killed, it's not optimal. We're going to fix it. All of it," Obama said, referring to perceived security lapses around US diplomatic personnel in Libya.
Some Republicans were already complaining that the president's use of the word "optimal" betrayed what they say is the lack of seriousness with which he dealt with the crisis.
Obama's performance at the second debate in Long Island on Tuesday steadied supporters reduced to panic after the first debate.
But there was bad polling news on Thursday to further rattle Democrats as Obama slipped seven points behind Romney in Gallup's daily national tracking poll.
The former Massachusetts governor led 52 to 45 percent among voters likely to cast ballots in the 6 November election.
But in two swing states crucial to Obama's hopes of reelection, the president was holding firm and was up 51 to 43 percent in Iowa and led Romney in Wisconsin by 51 to 45 percent.
If Obama picked up those two states and added bellwether Ohio to the list of safe states in his column, he would be guaranteed a second White House term in the election on 6 November.
Obama and Romney will meet in their last debate, in Florida on Monday, to discuss foreign policy, and Obama said he was already looking forward to confronting the Republican on Iraq.
"You know ... he said that it was tragic the way I ended the war in Iraq. Last week he said we should still have troops in Iraq," Obama said at a rally in the northeastern swing state of New Hampshire.