A Hamas government complex, was also targeted, taking out electricity in much of the city
Mahmud Hams, an AFP photographer, was in the agency's fourth-floor Gaza City office when the first Israeli air strike hit the building, rocking it and rattling the windows.
It didn't take long for the Israeli military to claim the strike.
"Direct hit confirmed," the official army spokesperson's Twitter account announced, saying Israeli warplanes had "surgically targeted a Hamas intelligence operations centre on 7th floor."
And then the army's French-language spokesperson's account weighed in through a tweet written directly to AFP's French-language feed.
"This building housed a Hamas intelligence HQ, do not be used as human shields," it warned.
"The Hamas terrorists weren't in the media building to be interviewed. They were there to communicate with field operatives and plan attacks," the English account added.
"Warning to reporters in Gaza: Stay away from Hamas operatives and facilities. Hamas, a terrorist group, will use you as human shields."
The first missile hit the building housing AFP's office at around 11:00 pm, startling Hams, an AFP photographer for eight years, inside the office.
"It didn't seem that close, although it shook the building, but we didn't realise it was above us," he said.
"About five minutes passed and then we heard two more loud explosions that also shook the building and the police radio started saying that our building, the Naama building, had been hit."
"I grabbed my cameras and left the office with the fixer and there was smoke in the hallways. We ran out of the building. When we got out to the street there were firefighters and ambulances. We could see smoke and a small fire," he added.
Others in the building also ran out into the street, including members of the Abu Halima family, from the northern Gaza town of Beit Hanun, who had moved into Naama tower, in the Rimal neighbourhood, in the hope that it would prove safer.
Moments later, an Israeli army spokesman confirmed the building had been targeted.
"We attacked the seventh storey of the building. From what we understand, Hamas had a military intelligence operations room there," he told AFP's Jerusalem bureau.
Soon after, an enormous blast hit a Hamas government complex, taking out electricity in much of the city and damaging the offices of the Al-Jazeera news station nearby.
And then around 2:00 am, an air strike targeted an empty building plot on the main coastal road that houses most of the hotels currently occupied by foreign journalists in Gaza.
It hit opposite the Beach Hotel, and near two hotels housing AFP staff.
The force of the blast shook the street, moving furniture and blowing out windows, including the glass fronting at the Commodore Hotel, which shattered over the reception area as journalists were sending stories.
No one was hurt in the attack, and it was unclear what the target was. There were no obvious signs of militant activity on the plot of land, which faces the sea. A giant crater could be seen on the scene of the strike, and a car next to the plot was partially destroyed.
The Israeli military would not say what the attack had targeted.
On Sunday and Monday, Israeli jets carried out three strikes against two buildings housing media offices, hitting one -- the Shuruq tower -- on both days.
The military said the strikes targeted militant communications and leaders. The two raids on Sunday injured eight journalists, including one who lost a leg.
The third raid on Monday killed a senior Islamic Jihad militant, according to the Islamist faction.
Late Tuesday afternoon, the Israeli military bombed a car with press markings in the Nasser neighbourhood of Gaza City, killing two cameramen from the Hamas-affiliated al-Aqsa TV.