The United States newly appointed Supreme Court judge has been sworn in.
The Senate backed Brett Kavanaugh's nomination by 50 votes to 48.
Mr Kavanaugh had been embroiled in a bitter battle to stave off allegations of sexual assault.
But after an 11th-hour investigation by the FBI into the allegations, enough wavering senators decided to back the nomination.
Ahead of the vote, hundreds of people protesting against Mr Kavanaugh's nomination demonstrated at the US Capitol in Washington.
During the vote, other protesters shouted "shame" from the public gallery and Vice-President Mike Pence had to call for order to be restored.
Mr Kavanaugh's appointment is for life and he will strengthen conservative control of the nine-judge court, which has the final say on US law.
Mr Trump sent out a tweet of congratulations:
I applaud and congratulate the U.S. Senate for confirming our GREAT NOMINEE, Judge Brett Kavanaugh, to the United States Supreme Court. Later today, I will sign his Commission of Appointment, and he will be officially sworn in. Very exciting!— Donald J. Trump (@realDonaldTrump) October 6, 2018
He also spoke to reporters aboard Air Force One, saying Mr Kavanaugh had withstood a "horrible attack by the Democrats" and that women were "outraged" at what had happened to the nominee.
Mr Kavanaugh will be sworn in later today.
So what were the numbers in the Senate?
The upper house is split 51-49 in favour of the Republicans and the vote was largely along party lines. In the end, there was indeed a two-vote margin.
The only party dissenters were Republican Senator Lisa Murkowski, who had intended to vote no, and Democrat Joe Manchin, who voted yes.
That should have meant a 51-49 tally, but the absence of Republican Steve Daines, a yes voter who was at his daughter's wedding, altered the final figures.
Ms Murkowski opted instead to simply mark herself as "present", leaving the final vote 50-48.
What was said in the Senate?
In their final summations, the two Senate party leaders reflected how bitter the divide had become.
Minority Democrat leader Chuck Schumer said Mr Kavanaugh did not belong on the bench as he had "obscured his views to the American people", "repeatedly misled the Senate" and delivered one of the "bitterest and most partisan testimonies ever presented by a nominee".
He also said Mr Trump had "stooped to new depths" in mocking the testimony of Mr Kavanaugh's accuser, Christine Blasey Ford.
Mr Schumer said that for all those who opposed the nomination, "there is one answer - vote" in the November mid-term elections.
Majority Republican leader Mitch McConnell said Mr Kavanaugh was a "serious scholar, a brilliant student of the law and a meticulous and dedicated public servant".
He said events had "strained our basic principles of fairness and justice" and that the vote showed the Senate was "an institution where evidence and facts matter".
He spoke of "intimidation by the mob" and said the Senate vote should be one "to turn away from darkness".
Ms Murkowski had earlier said that although Mr Kavanaugh was a "good man", he was "not the right person for the court at this time" and his "appearance of impropriety has become unavoidable".
Joe Manchin is facing a difficult re-election campaign in West Virginia, a traditionally Republican state that Mr Trump won by a landslide. He said he "found Judge Kavanaugh to be a qualified jurist".
There were shouts of "shame" from the public gallery as he voted yes.
Two Republican waverers, Susan Collins and Jeff Flake, finally decided to back the judge.