Billionaire media mogul Michael Bloomberg on Wednesday dropped out of the Democratic presidential race after a humiliating rejection by voters on Super Tuesday.

He said he wasn’t giving up on the fight to defeat President Trump and threw his support — and his fortune — behind former Vice President Joseph R. Biden.

“While I will not be the nominee, I will not walk away from the most important political fight of my life,” he said in a message to supporters. “I’ve always believed that defeating Donald Trump starts with uniting behind the candidate with the best shot to do it. After yesterday’s vote, it is clear that candidate is my friend and a great American, Joe Biden.”

Mr. Bloomberg entered the race late, skipped the first four nominating contests and poured more than $500 million of his vast fortune into an advertising blitz with nearly half of it aimed at Super Tuesday states.

The only contest he won Tuesday was in the U.S. territory American Samoa. He took home just four nominating delegates, which worked out to about $5 million per delegate.

Mr. Biden’s run surged on Tuesday with a string of wins that propelled him to the front of a two-candidate as the more traditional liberal alternative to avowed socialist Sen. Bernard Sanders of Vermont.

Mr. Bloomberg acknowledged that presence on the ballot only blunted the Biden surge.

“Three months ago, I entered the race for President to defeat Donald Trump. Today, I am leaving the race for the same reason: to defeat Donald Trump — because it is clear to me that staying in would make achieving that goal more difficult,” he said.

Similar to rivals who recently quit the race and quickly endorsed Mr. Biden, Mr. Bloomberg said the former vice president had the best shot at beating Mr. Trump.

“I’ve known Joe for a very long time. I know his decency, his honesty, and his commitment to the issues that are so important to our country — including gun safety, health care, climate change, and good jobs,” he said. “I’ve had the chance to work with Joe on those issues over the years, and Joe has fought for working people his whole life. Today I am glad to endorse him — and I will work to make him the next President of the United States.”

Mr. Bloomberg’s exit leaves just two major candidates hanging on as also-rans behind Mr. Biden and Mr. Sanders: Sen. Elizabeth Warren of Massachusetts and Rep. Tulsi Gabbard of Hawaii.

Former South Bend, Indiana, Mayor Pete Buttigieg and Sen. Amy Klobuchar of Minnesota quickly endorsed Mr. Biden after they dropped out of the presidential race following the primary Saturday in South Carolina.

Mr. Biden’s solid win in the Palmetto State began a consolidation of support for him from the Democratic Party establishment that fueled his wins on Tuesday.

President Trump basked in the news.

“I could have told him long ago that he didn’t have what it takes, and he would have saved himself a billion dollars, the real cost,” Mr. Trump said on Twitter. “Now he will pour money into Sleepy Joe’s campaign, hoping to save face. It won’t work!”

Mr. Trump also predicted that “Mini Mike Bloomberg will now FIRE Tim O’Brien, and all of the fools and truly dumb people who got him into this MESS.”

“This has been the worst, and most embarrassing, experience of his life…and now on to Sleepy Joe!” the president tweeted.

• Seth McLaughlin contributed to this article.