The Pentagon said Iran fired "more than a dozen" ballistic missiles.
Iraqi's military said there were no Iraqi casualties after the ballistic missile strikes.
"Between 1:45 am and 2:15 am (2245 GMT and 2315 GMT) Iraq was hit by 22 missiles, 17 on the Ain al-Asad air base and ... five on the city of Arbil," the Iraqi military command said in a statement.
"There were no victims among the Iraqi forces," the Iraq military said.
The US said Iran had launched missiles targeting its military and coalition forces stationed in Iraq.
"At approximately 5.30 pm (2230 GMT) on January 7, Iran launched more than a dozen ballistic missiles against US military and coalition forces in Iraq," Assistant to the Secretary of Defense for Public Affairs Jonathan Hoffman said.
After the missile strikes, Iran's foreign minister in a tweet said: "Iran took & concluded proportionate measures in self-defense under Article 51 of UN Charter targeting base from which cowardly armed attack against our citizens and senior officials were launched."
"We do not seek escalation or war, but will defend ourselves against any aggression," Zarif added.
Just minutes later US President Trump shot back in a tweet saying: "All is well, missiles launched from Iran at two military bases located in Iraq. Assessment of casualties & damages taking place now. So far, so good!"
All is well! Missiles launched from Iran at two military bases located in Iraq. Assessment of casualties & damages taking place now. So far, so good! We have the most powerful and well equipped military anywhere in the world, by far! I will be making a statement tomorrow morning.
"We have the most powerful and well-equipped military anywhere in the world, by far!"
Trump said he would be making a statement on Wednesday.
Iran had vowed revenge on the US after the assassination of General Qasem Soleimani who was killed in a US drone strike at Baghdad airport last week.
"These bases have been on high alert due to indications that the Iranian regime planned to attack our forces and interests in the region," a Pentagon spokesman said.
Meanwhile, the US Federal Aviation Administration(FAA) said it was banning all US-registered carriers from flying over Iraq, Iran and the Gulf after the missile attacks on US bases in Iraq.
Air France, UAE carriers Emirates Airline and low-cost Flydubai cancelled flights to Baghdad after Iran fired ballistic missiles on US bases in Iraq.
"We condemn this attack on Iraqi military bases hosting the coalition including British forces," Britain's foreign secretary Dominic Raab said, adding, "We are concerned about reports of casualties and use of ballistic missiles."
Germany's defence minister Annegret Kramp-Karrenbaue joined the UK to condemn the strikes calling it an "aggression".
"It is now crucial that we do not allow this spiral to continue," Annegret Kramp-Karrenbauer told a television channel, adding, "it is now primarily up to the Iranians to refrain from further escalation."