The lawmakers — many of whom face re-election next year — eagerly returned the favor as the president brought several of them to the lectern, where they offered a common refrain: paeans to Mr. Trump, his legislative victory and his presidency.

Senator Orrin G. Hatch, Republican of Utah and the chairman of the Finance Committee, said Mr. Trump might end up being one of the country’s greatest presidents. Members of Congress who have at times been on the receiving end of brutal Twitter posts made by the president, including Senator Mitch McConnell, Republican of Kentucky and the majority leader, returned the president’s praise in kind.

“This has been a year of extraordinary accomplishment for the Trump administration,” Mr. McConnell said, as the president grinned broadly behind him.

But though Mr. Trump listed a series of accomplishments during his first year in office, he confronts a challenge in the new year of persuading more Americans to get behind him.

His approval rating in polls of the American public is at historic lows, with a majority of people holding negative views of his presidency. Next year, he will face a Senate majority that will have shrunk to just one vote, making it even harder to win approval for the rest of the Republican agenda.

And while his lawyers have suggested that they believe the special counsel’s Russia investigation is winding down, there is evidence that Mr. Trump and his associates will remain under scrutiny for months, if not longer. Two members of Mr. Trump’s campaign team have been indicted, and two others, including Michael T. Flynn, his former national security adviser, and George Papadopoulos, a foreign policy consultant, have pleaded guilty to federal crimes and are cooperating with the special counsel.

The tax victory was a rare moment of legislative success for a president who has struggled to govern in a city that he derided as “a swamp.” He has repeatedly used Twitter, his favorite means of communication, to demean and belittle members of both parties, undermining Republican leaders and generating intense opposition from Democrats.