The suspected gunman, identified as Payton Gendron, was arraigned late Saturday on a single count of first-degree murder and held without bail, the Erie County district attorney's office said. He pleaded not guilty.
“The evidence that we have uncovered so far makes no mistake that this is an absolute racist hate crime,” Buffalo police commissioner, Joseph Gramaglia, said.
Mr Gramaglia told reporters the 18-year-old suspect did “reconnaissance” on the predominantly black area surrounding Tops Friendly Market and drove there from his home town of Conklin, more than 320 kilometres away.
United Nations chief Antonio Guterres sharply condemned the shooting deaths of 10 people at a grocery store in New York State, his spokesman said on Sunday.
“The Secretary General was appalled by the killing of 10 people in a vile act of racist violent extremism in Buffalo, New York, on 14 May,” UN deputy spokesman, Farhan Haq, said in a statement. “He extends his deepest condolences to the families and loved ones of the victims and hopes justice will be served swiftly.”
Many people across the US have decried easy access to powerful guns and the latest eruption of racist violence.
“This individual came here with the express purpose of taking as many black lives as he possibly could.” Buffalo Mayor Byron Brown said.
New York Governor Kathy Hochul, a Buffalo native, described the shooting as a “military-style execution” and said racist messaging was “spreading like wildfire,” especially online.
US President Joe Biden condemned the racist extremism and “hate that remains a stain on the soul of America.”
Attorney General Letitia James described Saturday's murderous assault as “domestic terrorism, plain and simple.”
“I held in my arms a young lady who worked at Tops, who was so afraid that she was about to die, who witnessed the bloodshed, who shaked and quivered in my arms,” Ms James said.
“Who is afraid for her community, afraid also for herself.”
Denise Walden, a Buffalo resident, voiced fear that she “can't go to the grocery store around the corner from my house because I might not get home to my kids safe.”
Derryl Long, who was born in Buffalo, told AFP he “can't comprehend what was going through this man's mind.”
“He knew it was a black community,” the 67-year-old added. “It just hurts.”
The gunman shot four people in the store's car park, three of them fatally, before entering the supermarket.
Among those killed inside was a retired police officer working as a security guard. He fired several shots at the assailant before being shot himself, police said.
Along with state charges, the rampage is being investigated as a federal hate crime “perpetrated by a racially motivated violent extremist,” Stephen Belongia, special agent in charge of the FBI's Buffalo field office, told reporters.
Agencies contributed to this report.