They said police and soldiers responded, using drones to track the attackers while a helicopter hovered overhead. A gunbattle ensued.
The official News Agency of Nigeria quoted police Superintendent Dolapo Badmos as saying gunmen invaded the Igando neighborhood but police "swiftly moved in and foiled the attack."
Residents said at least two police officers were wounded. They spoke on condition of anonymity for fear of reprisals.
It was the second such attack this month in Lagos.
Militants have threatened to attack Lagos and Abuja, Nigeria's capital, to press demands for a greater share of wealth for residents of the oil-producing south suffering oil pollution.