Nigeria's navy says it has rescued a Singapore-owned oil tanker hijacked by pirates on Tuesday night with 23 Indian sailors on board.
A navy spokesman told the BBC the crew was safe, the hijackers had fled and the vessel, the Abu Dhabi Star, was being escorted into the port of Lagos.
Earlier, the navy denied reports that the tanker was seized in the port.
There has been a significant increase in the number of pirate attacks in parts of West Africa.
The BBC's Will Ross in Lagos says unlike the piracy off the coast of Somalia where hostages are held for ransom, in the Gulf of Guinea the armed gangs are after the cargo which is usually swiftly offloaded.
Navy spokesman Commodore Kabir Aliyu said no shots were fired before the hijackers abandoned the Abu Dhabi Star.
Earlier the navy had sent two ships and a helicopter to the scene.
"We want to commend the superb effort of the Nigerian navy in securing the safe release of the Abu Dhabi Star. There were no casualties and the cargo is intact," Pottengal Mukundan, the director of the International Maritime Bureau, told the BBC.
"It is very important that the Nigerian authorities apprehend, investigate and try those who carried out the attack," he said.
Our correspondent says questions will be asked as to how the pirates were able to hijack the ship so close to the coastline and how they managed to escape.
Last month there were two similar hijackings just along the coast near Togo.
In both incidents the oil was siphoned off before the vessels and crew were released.
Last year, Nigeria and neighbouring Benin began joint naval patrols in an effort to combat the threat of pirates. The rescue of the Abu Dhabi Star is a rare case of a successful and swift intervention.