Law enforcement have shot dead a man who "came at the officers" with a military-style knife outside a Boston pharmacy.

An FBI agent and a policeman both fired on the suspect who was under surveillance.

The man was identified as Usaamah Rahim in a USA Today report and was a "person of interest'', according to Boston police spokesman Officer Stephen McNulty.

William Evans, Boston's police commissioner said the man refused repeated orders by members of the Joint Terrorism Task Force to drop a military-style knife.

"The officers asked him several times to put the knife down," Evans said.

Police then opened fire on the man who later died in hospital from his injuries.

"Unfortunately, he came at the officers and, you know, they do what they were trained to do and, unfortunately, they had to take a life," Evans said.

The man, who was approached on foot, pulled out a knife after the investigators identified themselves as law enforcement, when they asked him to stop at around 7am local time.

A police spokesman said the man was in his mid-20s and of Middle Eastern appearance, according to the Boston Globe.

The dead man was part of a broader terror investigation involving suspected Islamist extremists being tracked by the US Joint Terrorism Task Force, a law enforcement official said.

The suspect belonged to an ad hoc terror network, said a second law enforcement source according to CBS 6 TV.

terrorism suspect shot dead
Facebook message from the brother of Usaamah Rahim who was shot dead by Boston police. Facebook: Ibrahim Rahim

Rahim's brother, Ibrahim Rahim posted a series of tweets for time to "grieve''.

"We are deeply grieved by the loss of Usaamah,'' Rahim wrote. "We understand the need 4 info but ask that the press 2 give us time to grieve as a family.''

Confirmation of the dead man's name came from the Council of American-Islamic Relations.

Spokesperson Ibrahim Hooper said his organisation had spoken to Rahim's older brother, Imam Ibrahim Rahim, who had confirmed the death.

"He did confirm that it was his brother that was shot," Hooper told The Boston Globe. 'He spoke in a very calm, matter of fact way."

The elder Rahim wrote in a Facebook post that his brother was shot three times in the back while waiting at a bus stop to go to work.

However, officials say he was shot in the chest.