WASHINGTON — Judge Neil M. Gorsuch was confirmed by the Senate on Friday to become the 113th justice of the Supreme Court, capping a political brawl that lasted for more than a year and tested constitutional norms inside the Capitol’s fraying upper chamber.

The moment was a triumph for President Trump, whose campaign appeal to reluctant Republicans last year rested in large part on his pledge to appoint another committed conservative to succeed Justice Antonin Scalia, who died in February 2016. However rocky the first months of his administration may have been, Mr. Trump now has a lasting legacy: Judge Gorsuch, 49, could serve on the court for 30 years or more.

“As a deep believer in the rule of law, Judge Gorsuch will serve the American people with distinction as he continues to faithfully and vigorously defend our Constitution,” the president said.

The final tally was 54-45 in favor of confirmation.

The confirmation was also a vindication of the bare-knuckled strategy of Senate Republicans, who refused even to consider President Barack Obama’s Supreme Court pick, Judge Merrick B. Garland, saying the choice of the next justice should belong to the next president.