Most of the victims were African American.
Mr. Guterres was appalled by this “vile act of racist violent extremism”, UN Deputy Spokesperson Farhan Haq said in a statement.
“The Secretary-General condemns in the strongest terms racism in all its forms and discrimination based on race, religion, belief or national origin. We must all work together towards building more peaceful and inclusive societies,” he said.
The UN chief extended his deepest condolences to the families and loved ones of the victims and hoped that justice will be served swiftly.
The gunman was arrested following a stand-off with the police.
The incident marked the deadliest mass shooting in the United States this year.
It follows other recent racist massacres, including the June 2015 murder of nine African Americans at a church in Charleston, South Carolina, and the October 2018 attack on the Tree of Life Synagogue in Pittsburgh, Pennsylvania, in which 11 people were killed and six wounded.