Donald Trump is enjoying a postelection increase in goodwill and economic optimism as he prepares to take office, but the nation remains more divided than is typical at the dawn of a new presidency, a new Wall Street Journal/NBC News poll finds.

Mr. Trump, who had been the most unpopular presidential candidate in modern political history, is now viewed positively by 41% of voters, up from 29% in mid-October and higher than at any point in the campaign. The poll also found a marked upswing in optimism about the economy and the direction of the country.

But those improvements are due almost entirely to a mood shift among Republicans, and the poll found a deep split between Americans who are excited about his victory and those who are scared by it. With 47% viewing Mr. Trump unfavorably, more see him in a negative light than a positive one, and more than four in 10 Americans are worried that he lacks the temperament to be president.

It is a mixed picture that shows Mr. Trump gaining ground after his upset victory but in a weaker position than most newly elected presidents.

“Usually, elections settle arguments and the nation comes together, at least in the short term,” said Fred Yang, a Democratic pollster who conducted the survey—the first Journal/NBC poll since Election Day—with Republican Bill McInturff. “Today, hard feelings persist on both sides of the partisan divide. It is as if the campaign has never ended.”

Still, Mr. McInturff said, “the Trump presidency in its beginning stages has unleashed in multiple measures a surge in economic enthusiasm and confidence.”

When asked about the direction of the country, the share of registered voters saying it is on the wrong track dropped to 54% from 65% in mid-October.

But there was a big disparity between the parties’ postelection moods: 75% of Democrats saw the country on the wrong track, compared with 37% of Republicans.

When asked about the outlook for the economy over the next year, 42% of Americans said it would get better and 19% said worse. That marked the highest level of economic optimism since October, 2012. But, again, Republicans were more optimistic than Democrats.

The Republican Party is now viewed positively by 35% of registered voters, up from 26% in October. But the poll showed Mr. Trump’s election wasn't a victory for Republican orthodoxy: When Trump supporters were asked why they voted for him, 1% said the most important reason was to advance traditional Republican policies. By contrast, more than one-quarter said the prime reason was to improve the economy, while 23% said it was to put America first rather than focusing on other countries. Some 21% said it was to defeat Democratic nominee Hillary Clinton.

Typically, in the months after a presidential election, polls have found that the winner enjoys a honeymoon and the benefit of the doubt even from those who didn't vote for him. But Mr. Trump is meeting more skepticism and hostility than his predecessors.

More than four in 10 Americans are worried that Donald Trump, shown at a Friday rally in Orlando, Fla., lacks the temperament to be president. Photo: Willie J. Allen Jr./Associated Press

Asked how they felt Mr. Trump would do as president, 45% of Americans said they were optimistic and satisfied. By contrast, in January, 2009, 66% said they were optimistic and satisfied with newly elected Barack Obama. In January, 2000, 59% were optimistic and satisfied with George W. Bush, even after divisive postelection litigation.

Similarly, while 50% approve of how Mr. Trump is handling the transition, 73% said they approved of Mr. Obama’s transition handling in December, 2008.

The poll found a mostly partisan, mixed verdict on Mr. Trump’s cabinet appointments and intended nominations, with 43% pleased and 44% displeased with his choices.

Mr. Trump’s intended nominees have included three generals and several millionaires and billionaires. A strong majority in the survey didn’t buy the argument that his selection of generals was giving too much power to the military: 61% said it was a good idea, while only 29% said it was a bad idea. More people were riled by his naming wealthy people to the administration: 43% said it was a good idea, and 47% said it was a bad one.

Americans also are split over issues raised by Mr. Trump’s transition from private life to the White House. Asked if his business interests would present a conflict of interest, 35% said this was a major problem, while 23% called it a minor problem. Some 28% said it was no problem at all.

Asked about the influence of Mr. Trump’s children in his administration, 39% said they would have too much influence; 38% said they would have the right amount of influence; and 14% said they would not have enough influence.

The poll found that the year as a whole has been a troubling one for many Americans. More than half of Americans—55%—said 2016 was one of the worst years ever or was below average, while just 15% said it was one of the best or above average. Last year, that assessment split almost evenly, with 29% calling 2015 one of the worst years and 28% calling it one of the best.

Few Americans expect Washington to now be less divisive. Just one quarter said they expected 2017 to be a period of congressional unity between the two parties, while 70% said the Capitol would be dominated by division and unwillingness to compromise.

That presents a challenge to Mr. Trump, whose clearest mandate is to break Washington’s gridlock and solve problems.

“It is incumbent upon the new president to reach out beyond his base and find common ground. On the other hand, as the saying goes, it takes two to tango,” said Mr. Yang, “and the poll results suggest that the loyal opposition still harbors enough bitterness and disappointment where any olive branch by the new president may not be favorably received.”

The poll of 1000 adults was conducted Dec. 12-15 and has a margin of error of plus or minus 3.1 percentage points. It included interviews with 888 registered voters, with a margin of error of plus or minus 3.29 percentage points.

Write to Janet Hook at janet.hook@wsj.com