Race has been a big issue in this campaign, moderator Lester Holt told the two candidates as the debate turned to 'America's direction'.
Hillary Clinton talked about a "plague of gun violence in our country" while Mr Trump said "We need law and order".
"Race remains a significant challenge in our country," said Mrs Clinton.
"We have to restore trust between communities and the police," she said.
"Everyone should be respected by the law and everyone should respect the law," she said. "Right now, that's not the case in a lot of our neighbourhoods."
In reply, Mr Trump said: "Secretary Clinton doesn't want to use a couple of words - and that's law and order."
"We need law and order and if we don't have it, we're not going to have a country," he said.
Mr Trump advocated a 'stop and frisk' policy for police. However, Mrs Clinton said this policy was found to be unconstitutional and was ineffective.
In one of the more heated exchanges, the two candidates attacked each other for the controversy Mr Trump stoked for years over whether US President Barack Obama was born in the United States.
The president, who was born in Hawaii, released a long form birth certificate in 2011 to put the issue to rest. Only this month did Mr Trump say publicly that he believed Mr Obama was US-born.
"He (Trump) has really started his political activity based on this racist lie that our first black president was not an American citizen. There was absolutely no evidence for it. But he persisted. He persisted year after year," Mrs Clinton said.
Mr Trump repeated his false accusation that Mrs Clinton's failed 2008 presidential campaign against Mr Obama had initiated the so-called "birther" issue.
"Nobody was pressing it, nobody was caring much about it ... I was the one that got him to produce the birth certificate and I think I did a good job," Mr Trump said.
African-American voters overwhelmingly support Mrs Clinton, but Mr Trump in recent weeks has said he believes his policy agenda would benefit them and said the policies of Mr Obama and Mrs Clinton had failed to help black Americans.
He said Mrs Clinton's arguments were disingenuous.
"When you try to act holier than thou, it really doesn't work," Mr Trump said.
Hillary Clinton and Donald Trump also traded blows over the Democrat's use of a private email server as secretary of state, and the Republican billionaire's refusal to release his tax history.
"I will release my tax returns against my lawyer's wishes when she releases her 33,000 e-mails that have been deleted," Mr Trump said when pressed on the issue during their crucial first White House debate.
"I have no reason to believe that he's ever going to release his tax returns, because there's something he's hiding," Mr Clinton fired back.