The detonation took place near the back entrance of the building, CNN reported.
An Oil Ministry official said the bomb was reportedly planted under a car belonging to an officer.
"Security is very tight in the area and we believe those behind the attack were hoping the vehicle would be allowed to enter the ministry compound and explode inside," the official told CNN.
"Security is always tight at the ministry, but if the vehicle had exploded inside the compound, there would have been dozens of deaths," said Bakri al-Areqi, a resident who lives near the ministry.
No group has claimed responsibility for the attack.