President Trump forged a bond Tuesday with Saudi Arabia’s new crown prince over increased U.S. military sales to the kingdom and their shared disapproval of the Iran nuclear deal, as they sought to erase eight years of strained relations under former President Obama.

Hosting 32-year-old Crown Prince Mohammed bin Salman at the White House, the president said the U.S.-Saudi relationship is now “as good as it’s really ever been.” Mr. Trump said the Iran deal, which he is threatening to rip up by a congressional May 12 deadline, was a key item on their agenda.

“Iran has not been treating that part of the world or the world itself appropriately,” Mr. Trump told reporters. “A lot of bad things are happening in Iran. The deal is coming up in one month, and you will see what happens.”

When reporters asked the crown prince about the Iran deal, he said only, “We’ll talk about that today.”

The hard-charging Crown Prince Salman, heir to the Saudi throne, noted that the U.S. and Saudi Arabia have been allies for 80 years. That relationship worsened under Mr. Obama when he signed the Iran deal in 2015 over opposition from the Saudis, who are adversaries of Iran.

Mr. Obama also angered Saudi Arabia in 2013 when he decided not to order a military strike against Syrian President Bashar Assad, a foe of the Saudis, over his use of chemical weapons.

“I would really have to say the relationship was, to put it mildly, the relationship was very, very strained during the Obama administration,” Mr. Trump said.

The Obama administration also halted some U.S. arms sales to Saudi Arabia over concerns about civilian deaths in neighboring Yemen, where Saudi Arabia is waging war against Iranian-backed rebels. The conflict has led U.S. lawmakers to propose a cutoff in support for a Saudi-led bombing campaign that has killed thousands.

The Senate rejected an attempt Tuesday to force the U.S. to cease “hostilities” in Yemen, allowing Mr. Trump to continue aiding the Saudi-led coalition in the fight.

A bipartisan group of senators, led by Sen. Bernard Sanders of Vermont, had called for an end to American support, saying only Congress can declare wars to commit military support and Congress has not done so. But senators voted 55-44 to table that resolution.

The Pentagon is providing aircraft refueling and targeting capabilities to Saudi Arabia-backed forces. Senate Majority Leader Mitch McConnell said halting assistance would also be seen as a victory for Iran.

The crown prince oversaw the invasion of Yemen as defense minister in 2015. Neither Mr. Trump nor his guest mentioned Yemen or the humanitarian crisis there to reporters, instead focusing on the huge increase in military hardware that Saudi Arabia is purchasing from the U.S., and the boon to the U.S. economy.

“Saudi Arabia is a very wealthy nation, and they’re going to give the United States some of that wealth, hopefully in the form of jobs, in the form of the purchase of the finest military equipment anywhere in the world,” Mr. Trump said.

The president ticked off a list of sales or pending sales: “The THAAD [missile defense] system — $13 billion; the C-130 airplanes, the Hercules, great plane — $3.8 billion; the Bradley Vehicles — that’s the tanks — $1.2 billion; and the P-8 Poseidons — $1.4 billion.”

“And what it does is it really means many, many jobs,” Mr. Trump said. “We’re talking about over 40,000 jobs in the United States. Saudi Arabia is buying a lot of this equipment, and a lot of people are at work making this equipment.”

The crown prince said Saudi Arabia has decided to double its investment in U.S. businesses to $400 billion in just one year.

“That [is] why we are here today, to be sure that we’ve tackled all the opportunities and achieve it, and also get rid of all the threats facing our both countries and the whole world,” he said.

• Stephen Dinan contributed to this article.