The Senate confirmed Jay Clayton, the U.S. attorney in Manhattan, on Tuesday to oversee the nation’s intelligence agencies, installing a longtime ally of the president into a top national security post that has waned in significance during the second Trump administration.

The vote, 51 to 47, was along party lines. Though his nomination was initially met with some good will from Democrats, Mr. Clayton shed that bipartisan support during his confirmation hearing this month after he refused to clearly state that Joseph R. Biden Jr. had won the 2020 presidential election.

Though Democrats opposed Mr. Clayton, some have privately expressed relief that he will take the reins of the Office of the Director of National Intelligence from Bill Pulte, a housing official who has pursued campaigns of retribution against President Trump’s perceived enemies.

Still, in a statement after the vote, Senator Mark Warner, Democrat of Virginia, voiced some skepticism about Mr. Clayton, despite their longstanding relationship.

“I came away from his confirmation process with serious reservations about whether he would be willing to stand up to political pressure when it matters most,” said Mr. Warner, the top Democrat on the Senate Intelligence Committee. “Now that he has been confirmed, I sincerely hope he proves those concerns unfounded, because the intelligence community deserves steadier leadership than it has received in recent months.”

In serving as the acting director, Mr. Pulte has downsized the spy office, making gleeful pronouncements of his moves on social media. On Tuesday morning, Mr. Pulte claimed on X that he had just executed a “5th and Near Final Round of TERMINATIONS” that totaled a 30 percent staff reduction during his short tenure, though current and former officials said it was unclear whether many of those cuts had actually taken place.