"The secretary-general reiterates the solidarity of the UN with the people and government of Kenya in their struggle against terrorism," Xinhua quoted a statement issued by Ban's spokesman as saying.
"He trusts the authorities will do all in their power to bring the perpetrators to justice in a manner that is fully respectful of Kenya's human rights obligations."
"The secretary-general extends his condolences to the families of the deceased and the government of Kenya and wishes the wounded a swift recovery," the statement said.
Witnesses said around 50 armed attackers with explosives stormed the busy eastern coastal town in vehicles, shooting at the residents.
Mpeketoni is now like a ghost town as many residents are still not back home after they took cover in the bushes, they said.
The Somalian Islamist militant group Al-Shabaab Monday claimed responsibility for the attack.