Pictures showed smoke and dust rising from the flattened structure, which was next door to the Iranian embassy on a highway in the western Mezzeh district.
One Iranian news agency said five people were killed, while a UK-based monitoring group put the toll at eight.
The Israeli military said it did not comment on foreign media reports.
The Syrian military said Israeli aircraft targeted the consulate building from the direction of the occupied Golan Heights at about 17:00 local time (14:00 GMT).
Syrian air defences shot down some of the missiles launched by the aircraft, but others struck the building and led to its complete destruction and the killing or injuring of everyone who was inside at the time, the military added.
The military said work was under way to recover the casualties from underneath the rubble.
It gave no details about the identities of those killed, but Iranian state TV reported that no embassy personnel were inside the building at the time of the attack.
A Lebanese security source told Reuters news agency that those killed included a senior commander in Iran’s Revolutionary Guards, Mohammad Reza Zahedi.