Ten plain-clothed police officers were responding to information that there was a large gathering in the Grahame Park Estate in Colindale at 7pm on Thursday, police said.
A Metropolitan Police spokesman said the officers approached a group of six local men who immediately ran off. The officers gave chase on foot.
During this chase, it is believed that a firearm was discharged a number of times by one of the suspects towards the unarmed officers.
Nobody was injured, although officers were said to be “shaken” by the shooting.
Armed response vehicles were deployed to the scene and a thorough search of the area was conducted.
A 49-year-old man was arrested nearby on suspicion of constructive possession of a firearm, assaulting an emergency worker and possession of cannabis.
He remains in custody at a north London police station. He is not believed to be linked to the suspect group of males.
A Section 60 order, providing officers with additional search powers, was in place on the Grahame Park Estate overnight.
Det Chf Insp Gemma Alger, investigating, said: “The message is clear that any levels of violence against our colleagues who serve the public and keep our communities safe will not be tolerated. We are committed to finding those involved and fully investigating the circumstances.
“The repercussions of this split-second action could have been grave – we could potentially have been dealing with a murder investigation. Nobody should go to work fearing that they may never return home.
“We are seeking the help of the public to identify the group of around six males who are believed to have resorted to extreme violence when pursued by police.
“We encourage anyone who may have security, dashcam or doorcam footage, or any information relating to the incident or suspect group to please get in touch. You can do so anonymously via the independent charity Crimestoppers who will not even ask for your name.”
Police said the past 12 months, there have been 7,140 recorded assaults on Met Police officers – an increase of 19.1 percent on the previous year.
Anyone who witnessed the incident, or who has information about those involved, is urged to call 101 or Tweet @MetCC quoting CAD6602/18MAR.
Information can also be provided to Crimestoppers, 100% anonymously, by calling 0800 555 111 or visiting crimestoppers_uk.org.