"We don't authorize either the use of military bases or the use of airspace for actions related to the war in Iran," she told reporters in Madrid.
Spanish newspaper El Pais had first reported the news on Monday, citing military sources.
The closure of the airspace forces military planes to bypass NATO member Spain en route to their targets in the Middle East, but it does not include emergency situations, El Pais added.
"This decision is part of the decision already made by the Spanish government not to participate in or contribute to a war which was initiated unilaterally and against international law," Economy Minister Carlos Cuerpo said during an interview with radio Cadena Ser when asked if the decision to close Spain's airspace could worsen relations with the United States.
Spanish Prime Minister Pedro Sanchez has been one of the most vocal opponents of the U.S. and Israeli attacks on Iran, describing them as reckless and illegal.
President Donald Trump has threatened to cut trade with Madrid for denying the U.S. use of Spain's bases in the war.
(Reporting by Paolo Laudani and Emma Pinedo; additional reporting by Victoria Waldersee; editing by Charlie Devereux and Gareth Jones)

Undated file photo of a US U2 Spy plane. Iraq said a spy plane crossed its international border from Saudi Arabia. The U-2 spy plane was the first of many secrets kept at Area 51. (Photo: US Air Force)