Ten people have died in what police have claimed was a “racailly motivated attack”.
He then proceeded to shoot 13 people - 11 of whom were black.
The man broadcast the shooting live on the streaming platform, Twitch, for up two minutes before the transmission was cut.
“He exited his vehicle. He was very heavily armed. He had tactical gear. He had a tactical helmet on. He had a camera that he was livestreaming what he was doing,” city police commissioner Joseph Gramaglia said at a news conference afterward.
The shooter was later named as Payton Gendron of Conklin, a community about 200 miles (320km) south-east of Buffalo in New York state.
Police said Gendron initially shot four people outside the market before entering the shop where a security guard opened fire.
The bullets struck Gendron’s body armour and he then proceeded to shoot and kill the security guard.
He then walked through the supermarket where he shot at other victims.
After police confronted the gunman, he surrendered and was arrested. He later appeared in court charged with first degree murder.
“At that point the suspect put the gun to his own neck. Buffalo police personnel – two patrol officers – talked the suspect into dropping the gun. He dropped the gun, took off some of his tactical gear, surrendered at that point. And he was led outside, put in a police car,” he said.
Commenting on the incident, President Joe Biden said: “We still need to learn more about the motivation for [the] shooting as law enforcement does its work, but we don’t need anything else to state a clear moral truth: A racially motivated hate crime is abhorrent to the very fabric of this nation.
“Any act of domestic terrorism, including an act perpetrated in the name of a repugnant white nationalist ideology, is antithetical to everything we stand for in America.
“Hate must have no safe harbor. We must do everything in our power to end hate-fueled domestic terrorism.”
Buffalo’s mayor, Byron Brown, said: “This is the worst nightmare that any community can face, and we are hurting and we are seething right now. The depth of pain that families are feeling and that all of us are feeling right now cannot even be explained.”