Hotels, restaurants and the police station were attacked in the mainland town near the tourist resort Lamu island.
Somalia's Islamist al-Shabaab group claimed credit for the attack on Monday, saying it was carried out to retaliate for the presence of Kenyan troops in Somalia and the killing of Muslims. Kenya was among countries that sent troops to Somalia in 2011 to help defeat the militants.
The attack occurred Sunday afternoon as Mpeketoni residents watched the World Cup on television. They said armed men stole a van and drove around town, shooting at various locations. Witnesses added the gunmen -- about 50 in number and with their faces covered -- stole weapons from the police station after tossing explosives into it.
Hotels, restaurants and banks were burned, said District Deputy Commissioner Benson Maisori. The Kenyan Tourist Board said no foreigners, only locals, were in the town during the incident.
The rampage lasted about three hours, and according to Leonard Omollo, Lamu County police commissioner, only men were targeted in the attack.