The airline, which formed an alliance with British Airways in 2010, said in a statement that the test "was only done to guarantee that they (women) did not face any risks", an argument that drew scorn on social media.
Iberia denied it rejected pregnant women for jobs, saying it had contracted five women who were expecting a baby last year to different roles. Since the beginning of 2016 it has moved 60 female employees to alternative roles to fit in with their pregnancies, it added.
"Iberia never ceased to hire a woman because she was pregnant if she met the requirements for the position," the airline said.
The airline's use of pregnancy tests was discovered by labour inspectors with the regional government of Spain's Balearic Islands, which in June fined the company. Iberia can appeal against the fine, a spokesman for the regional government said.
Health Minister Dolors Monstserrat said she "rejected" Iberia's practice of requiring new employees to take a pregnancy test.
"Maternity can in no way be an obstacle for access to a job," she told reporters.
Many people took to social media to dismiss Iberia's claimed justification for having required women to take pregnancy tests.
Of Iberia's roughly 16,000 workers, 46 percent are women, the company said, adding that 71 percent of its cabin crew are women.