Israel struck back at Iran early Saturday, delivering a much-threatened response for this month’s 180-missile attack and further expanding the hostilities that have spiraled out of the war in Gaza.

The attacks played out in several waves over multiple hours before wrapping up before daybreak. Israel said it had hit military targets in a number of areas, including missile manufacturing facilities and air defense sites.

Iran, which canceled flights until further notice early Saturday, had threatened to retaliate forcibly if its nuclear or oil infrastructure was attacked. The U.S. had urged Israel not to hit those targets, and governments around the world had cautioned against further escalation in the midst of concern that the violence could spin out of control.

Iran’s air defense authorities said the attacks targeted military centers in the province of Tehran, which includes the capital, as well as the Khuzestan and Ilam provinces in the west, along Iran’s border with Iraq. They were still investigating the full impact but said limited damage had been done.

“From what we know now, this is the best-case scenario in terms of keeping this round contained, given Israel seems to have limited its strikes to military targets rather than nuclear or oil infrastructure,” said Dalia Dassa Kaye, a senior political scientist at the University of California, Los Angeles, and former director of the Center for Middle East Public Policy at Rand. “This gives Iran an exit ramp if it’s looking for one. But we’re still in a different place, because Israel and Iran are now in a direct and open conflict.”

The U.S. was informed by Israel hours ahead of the attack and didn’t participate, U.S. officials said. Prime Minister Benjamin Netanyahu discussed Israel’s plans for the strike with President Biden on a call earlier this month, a U.S. official said. After the attack began, Defense Secretary Lloyd Austin spoke briefly by phone with Israeli Defense Minister Yoav Gallant, U.S. officials said.

A woman in central Tehran told The Wall Street Journal that she woke to the sound of continuous explosions Saturday. “My heart is jumping out of my chest,” she said. Iranian air defense authorities said their systems were firing in three locations around the capital, and the civil aviation agency canceled flights on all routes until further notice, according to the state-controlled news agency. The country earlier closed its airspace for several hours, according to a notice to pilots.

Iran struck Israel on Oct. 1 to avenge the killings of the Hamas political leader, Ismail Haniyeh , in Tehran, and the Hezbollah leader, Hassan Nasrallah , in Beirut, launching about 180 ballistic missiles. In recent conversations with Arab governments, Iran’s foreign minister said his country doesn’t want a wider war and suggested Tehran could absorb an Israeli retaliatory strike without escalating if it targeted military sites rather than sensitive oil or nuclear facilities, Arab officials said.

The strikes and threats marked the latest expansion of the fighting that began a year ago in Gaza, sparked by last year’s Hamas-led Oct. 7 attack on southern Israel that left 1,200 dead. Israel and Iran, after fighting a long war through proxies, have now exchanged fire directly twice this year.

Israel has also launched a major campaign in Lebanon, following up a year of back and forth exchanges of fire by sending troops into the country and carrying out more than 3,000 airstrikes in the past month, leaving more than 2,500 dead since the beginning of the conflict, according to Lebanese health authorities.

Fighting has escalated in Gaza with a major Israeli operation in the northern part of the enclave, while Iran-linked militias in Yemen and Iraq continue to strike at Israel, the U.S., and shipping in the Red Sea area. More than 42,000 people have been killed in Gaza since Oct. 7 last year, according to Palestinian health officials, who don’t say how many were combatants.

The violence has spread markedly in the region since Iran attacked Israel directly for the first time ever in April, sending more than 300 drones and missiles in a barrage that was largely shot down by Israel and its allies . Israel replied with a pinpoint strike on an air defense radar site in Iran.

Iran’s most recent strike at the start of this month, like the earlier one in April, was aimed at military and security facilities and did little damage. U.S. warships helped shoot down several of the ballistic missiles intended for Israel. Many missiles did get through Israel’s air defenses , raising concern about the likely damage if they had been targeted at population centers.

Netanyahu warned Iran regarding the strike that it had made a “big mistake” and would pay for it.

Write to Michael R. Gordon at michael.gordon@wsj.com and Lara Seligman at lara.seligman@wsj.com