HEMPSTEAD, New York (CNN) --- President Barack Obama fought back and Republican challenger Mitt Romney mostly stood his ground.
A forceful Obama defended his record and challenged Romney on shifting positions in the 90-minute debate, arguing his Republican rival's policies would favor the wealthy if elected.
Romney repeatedly attacked Obama's record, saying millions of unemployed people and sluggish economic recovery showed the president's policies had failed.
Obama was more animated and engaging than his understated and widely panned performance in their first debate nearly two weeks ago.
He and Romney, who also aggressively made his points, walked the floor at Hofstra University in Hempstead, New York, holding microphones, raising their voices and repeatedly challenging each other's points.
"Governor Romney says he's got a five-point plan. Governor Romney doesn't have a five-point plan; he has a one-point plan. And that plan is to make sure that folks at the top play by a different set of rules," Obama said about his opponent's approach for boosting the economy.
Romney shot back that Obama was "great as a speaker, but his policies don't work."
"That's what this election is all about," Romney said, saying he would prioritize middle class growth. "It's about how we can get the middle class of this country a bright and prosperous future."
However, Romney failed to provide further specifics of his tax policy, even when one audience member asked about unspecified deductions and loopholes the candidate says he will eliminate.
On a sensitive foreign policy topic, the candidates clashed at the front of the stage over the September 11 terrorist attack in Libya that killed four Americans, with Romney suggesting the Obama administration played politics by failing to immediately acknowledge what happened.
Obama shot back that the suggestion anyone in his administration would play politics on such an issue was "offensive." When Obama said he called it a terrorist attack shortly afterward, Romney challenged him, and Obama responded "check the transcript."
Moderator Candy Crowley, the CNN chief political correspondent, cut in to say both men were right -- Obama called it a terrorist attack when he said he did, but the administration took longer to fully explain what occurred.
Unlike the first presidential debate, the format was town hall-style, with audience members asking the questions. Crowley was the first woman to serve as moderator of a presidential debate in 20 years.
The first question came from a 20-year-old college student, worried about whether he'd be able to support himself after graduation.
"More debt and less jobs. I'm going to change that. I know what it takes to create good jobs again," Romney said, addressing the first-time voter. "When you come out in 2014 -- I presume I'm going to be president -- I'm going to make sure you get a job."
Obama needed a strong debate to try to blunt Romney's rise in the polls since their first showdown in Denver, when analysts and polls indicated the GOP challenger won a clear victory.
The most recent CNN "poll of polls" -- an aggregate of the latest major surveys -- showed Romney with a slight edge nationally at 48%-47%. In the battleground states considered up-for-grabs, polls show Romney has narrowed Obama's lead or caught the president just three weeks before the election.
The Obama campaign conceded he had a bad night in the first debate and promised a more aggressive approach in New York. A third and final debate focusing on foreign policy will take place October 22 in Florida.
Polls show voters consider the economy to be the most important election issue.
Unemployment fell below 8% in September for the first time since the month Obama took office in 2009. However, millions remain out of work and U.S. economic growth is anemic.
Romney and his campaign have sought to frame the election as a referendum on Obama's presidency, citing joblessness, slow recovery from the recession and chronic federal deficits and debt as reasons to deny a second term.
For their part, Obama and Democrats have tried to make the election about competing visions for the future. They argue Republican proposals to repeal major legislation, such as health care and Wall Street reforms, while cutting government and expanding tax cuts without identifying additional revenue sources would stall a sluggish but steady recovery.