Obama, delivering his last annual State of the Union speech to Congress as president, called for leaders to "fix" US politics and criticised candidates such as Trump for using anti-Muslim rhetoric that betrayed American values.
Trump, whom Obama did not mention by name in his speech, is leading the Republican field ahead of the November 8 election to pick the next president.
The billionaire businessman, citing national security concerns, has called for a temporary ban on Muslims entering the US and a wall on the US border with Mexico to stop the flow of illegal immigrants, ideas the White House strongly opposes.
Obama sought to contrast his more optimistic view of America's future with those of the Republican candidates trying to replace him.
He said it was "fiction" to describe the country as being in economic decline. While acknowledging that al Qaeda and Islamic State posed a direct threat to Americans, he said comparing the effort to defeat the militants who control swaths of Iraq and Syria to World War Three gave the group just what it wanted.
Obama's address to lawmakers, Cabinet members and Supreme Court justices was one of his last remaining chances to capture the attention of millions of Americans before the November election. The next president will take office in January 2017.
Obama, who is constitutionally barred from a third term, stuck to themes he hopes will define his legacy, including last year's nuclear pact with Tehran.
He noted areas where compromise was possible with Republicans in Congress including criminal justice reform, trade and poverty reduction.
He called for lawmakers to ratify a Pacific trade pact, advance tighter gun laws and lift an embargo on Cuba.
The president noted some outstanding promises from his own 2008 campaign. He pledged to continue to work to close the US prison at Guantanamo Bay, Cuba, and called on Congress to lift the embargo on the Communist-ruled island nation.