TEL AVIV—Shortly before 2 a.m. on Saturday in Israel, airmen and women wearing bomber jackets bearing the Star of David climbed into the cockpits of about 100 jet fighters, spy planes and refueling aircraft at an Israeli military base. They were following commands from an underground bunker known as the pit.

Israel’s wartime leaders, who were gathered in the bowels of the military headquarters in Tel Aviv, had just given the green light for the largest attack against Iran in Israel’s history—and its most politically perilous. They called the operation “Days of Repentance.”

The assault was calibrated to punish Iran for an attack on Israel but aimed to avoid setting off a full-scale war between the two foes involving American forces and other countries in the region. The attack steered clear of the oil and nuclear facilities that Iran had warned would prompt a retaliation, and appeared to heed the caution urged by U.S. officials.

The attack, however, marked a dangerous new phase of confrontation between Israel and Iran, which began striking each other directly earlier this year. It left Iran even more exposed to further air attacks, with Israel destroying several of the country’s Russian-made S-300 batteries, according to an Israeli official.

“The message is that we don’t want an escalation but if Iran decides to escalate and attack Israel again, this means that we have increased our range of freedom of movement in the Iranian skies,” an Israeli official said.

For weeks, Israeli Prime Minister Benjamin Netanyahu had signaled that Israel would hit back over Iran’s ballistic-missile assault on Israeli territory on Oct. 1. Pulling it off required weeks of planning and delicate diplomacy.

Iran “knew that Israel was coming, and still they couldn’t prevent anything,” said Assaf Orion, a retired Israeli brigadier general.

The U.S.—sensing an opening after Israel killed Hamas leader Yahya Sinwar —has been pushing for a cease-fire in Gaza. Secretary of State Antony Blinken visited Israel and other Middle East capitals this week in an effort to reach a deal that has eluded negotiators for months. The calibrated nature of the attack appeared to leave room for those talks to continue, with negotiators set to meet in the Qatari capital, Doha, on Sunday.

But even as Israel worked diplomatic channels that could end the war in Gaza and cool tensions with Tehran, Israeli officials were completing details of the retaliatory attack.

On Friday evening, as the sun set marking the start of Shabbat, the Jewish day of rest, Israel’s cabinet in a phone conversation led by Netanyahu agreed to move ahead with an attack that night, according to an Israeli official.

Hours before the attack began, Israel alerted the U.S. and several Arab-world and European capitals about the nature and scope of the attack, according to people familiar with the matter. Officials in some of those countries then alerted Iran.

Israel’s prime minister’s office later said the idea that it informed Iran about the nature or timing of the attack was “false and absurd.”

Iranians walk next to an anti-U.S. and Israeli billboard with pictures of Iranian President Masoud Pezeshkian and Iranian Armed Forces Chief of Staff, Major General Mohammad Bagheri and U.S. President Joe Biden and Israel’s Prime Minister Benjamin Netanyahu, on a street in Tehran, Iran, October 27, 2024. Majid Asgaripour/WANA (West Asia News Agency) via REUTERS

When they finally began, the Israeli strikes unfurled in waves. The attack involved Israel’s most-advanced aerial weapon, F-35 jet fighters, which are adept at evading radar, people familiar with the mission said.

As the jet fighters were airborne, Israeli officials—conscious that their U.S. counterparts were frustrated that Israel hadn’t forewarned last month that it would kill Hezbollah’s leader Hassan Nasrallah —also made a point of actively briefing their U.S. counterparts about their attack.

Israeli Defense Minister Yoav Gallant called his U.S. counterpart, Defense Secretary Lloyd Austin , who assured him of America’s readiness to defend Israel against backlash from Iran and aligned militant groups.

The first crop of jet fighters destroyed air-defense batteries in Syria and Iraq, clearing the flight path for the second and third sorties to funnel through to Iran.

Their exact route, which hasn’t been shared by Israel, appeared to dodge airspace in Jordan after the Arab nation said it wouldn’t be part of an attack on Iran. Most of the attacks were launched from outside Iranian airspace, said Amir Aviv, a former senior Israeli military official who is often briefed by the defense establishment. Iran said Israeli planes attacked from within Iraqi airspace, around 70 miles from its border.

At around 3.30 a.m. in Israel, the country’s military launched the second of at least three waves of attacks, according to people familiar with the matter.

Israel’s strikes targeted Iranian facilities involved in the production of missiles like the cruise and ballistic missiles that targeted Israel twice this year.

One of Israel’s hits was at the sprawling Parchin military site, where Iran once worked on nuclear weapons capabilities, according to the U.N. atomic agency. Four buildings were hit there, including three solid-propellant facilities for missiles, said Fabian Hinz , research fellow at the International Institute for Strategic Studies focused on Iran’s missile program.

Iranians walk in Tehran Bazaar after several explosions were heard, in Tehran, Iran, October 26, 2024. Majid Asgaripour/WANA (West Asia News Agency) via REUTERS

Just before sunrise, Israel’s military said its attack and retaliation were complete. The planes returned at the end of the four-hour assault with no losses.

Soon after, Iranian officials began privately telling Arab nations that the attack hit sites with great accuracy. In public, the regime said it led to “limited damage” and that Iran reserved the right to carry out a response at a time of its choosing. Four Iranian soldiers were killed in the attacks, Iran said.

A general view of Tehran after several explosions were heard, in Tehran, Iran, October 26, 2024. Majid Asgaripour/WANA (West Asia News Agency) via REUTERS

Israeli officials said they hope that the attack would end a tit-for-tat exchange of fire with Iran and Israel’s military could now focus on its war goals fighting Hamas in Gaza and Lebanon’s Hezbollah, Iranian allies.

Orion, the retired brigadier general, said the attack was calibrated but doesn’t mean the end of tensions with Iran. “It allows both sides to finish for now until the U.S. elections, and then see where it goes,” he added.

Iran’s Supreme Leader Ayatollah Ali Khamenei speaks during a meeting in Tehran, Iran, October 27, 2024. (West Asia News Agency)/Handout via REUTERS

Write to Rory Jones at Rory.Jones@wsj.com and Dov Lieber at dov.lieber@wsj.com