A man armed with a shotgun and smoke grenades burst into a newspaper office in the US city of Annapolis, killing five employees in what police described as a "targeted attack."

A witness gave a chilling account of how the attacker started shooting through a glass door to the newsroom of Capital Gazette, which publishes one of America’s oldest newspapers, The Capital, in Maryland state.

The gunman was a white man in his late 30s, police said. They said the motive was unclear, but revealed that threats had been sent to the local newspaper via social media before the deadly attack.

The suspect, who was being questioned in custody, was identified by multiple media outlets as Jarrod Ramos, a 38-year-old from Laurel, Maryland, who had a long-running dispute with the newspaper.

In 2012, Ramos filed a defamation lawsuit against the Capital Gazette and a columnist over a July 2011 story that covered a criminal harassment case against him, the newspaper reported.

The dead were named as four journalists - Gerald Fischman, Rob Hiaasen, John McNamara and Wendi Winters - and sales assistant Rebecca Smith. Two other people suffered minor injuries.